blob: eb2ba17bd92011e7b4cd2b25d2dbeb6ba0522ddc (
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
|
# -*- 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
end
end
end
end
|