blob: eb7096549b83fa98ac84941853016689d7738d31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# -*- frozen-string-literal: true -*-
module Plum
module Rack
module DSL
class Config
attr_reader :config
def initialize
@config = ::Plum::Rack::Config::DEFAULT_CONFIG.dup
end
def log(out)
if out.is_a?(String)
@config[:log] = File.open(out, "a")
else
@config[:log] = out
end
end
def debug(bool)
@config[:debug] = !!bool
end
def listener(type, conf)
case type
when :unix
lc = conf.merge(listener: UNIXListener)
when :tcp
lc = conf.merge(listener: TCPListener)
when :tls
lc = conf.merge(listener: TLSListener)
else
raise "Unknown listener type: #{type} (known type: :unix, :http, :https)"
end
@config[:listeners] << lc
end
def server_push(bool)
@config[:server_push] = !!bool
end
def threadpool_size(int)
@config[:threadpool_size] = int.to_i
end
def fallback_legacy(str)
h, p = str.split(":")
@config[:fallback_legacy_host] = h
@config[:fallback_legacy_port] = p.to_i
end
def user(username)
@config[:user] = username
end
def group(groupname)
@config[:group] = groupname
end
end
end
end
end
|