servel 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servel.rb +1 -0
- data/lib/servel/cli.rb +11 -1
- data/lib/servel/config_parser.rb +20 -0
- data/lib/servel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283ef8ff838b1a149aee4379a02233d006d5dfec7887de4791e20c2e61cbe86e
|
4
|
+
data.tar.gz: b6fa99503294d5bba7b338c86fd0eb9bb46b06944de3fe2b10b225a6120b6794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44b0fef9dac7e95483e13856f4b030813019c26ed7676a8154cdad88eef8b9db9b5075c4a463dc374353c0e73a09b9c408aa069b79f80da58c221451a227bc3
|
7
|
+
data.tar.gz: d7a4126762ab129714b328aaf1dd492a17d1354870f4f943f799e2816f490de1ef85af253f8f4fcb96bd1d879fff5a134a7043f48112f2fe00bce7eac4af237a
|
data/lib/servel.rb
CHANGED
data/lib/servel/cli.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
class Servel::CLI
|
2
|
+
ALLOWED_PUMA_OPTIONS = [
|
3
|
+
:Host,
|
4
|
+
:Port,
|
5
|
+
:binds
|
6
|
+
]
|
7
|
+
|
2
8
|
def start
|
3
|
-
Rack::Handler::Puma.run(Servel.build_app(path_map))
|
9
|
+
Rack::Handler::Puma.run(Servel.build_app(path_map), **puma_options)
|
4
10
|
end
|
5
11
|
|
6
12
|
def path_map
|
@@ -11,4 +17,8 @@ class Servel::CLI
|
|
11
17
|
[Pathname.new(root).realpath, url_root]
|
12
18
|
end.to_h
|
13
19
|
end
|
20
|
+
|
21
|
+
def puma_options
|
22
|
+
Servel.config.to_h.transform_keys(&:to_sym).slice(*ALLOWED_PUMA_OPTIONS)
|
23
|
+
end
|
14
24
|
end
|
data/lib/servel/config_parser.rb
CHANGED
@@ -12,6 +12,7 @@ class Servel::ConfigParser
|
|
12
12
|
@config.read if @config.exist?
|
13
13
|
|
14
14
|
@config.append(*parse_argv, to: :listings)
|
15
|
+
parse_binds
|
15
16
|
end
|
16
17
|
|
17
18
|
def parse_argv
|
@@ -20,4 +21,23 @@ class Servel::ConfigParser
|
|
20
21
|
{ root => url_root }
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
25
|
+
def parse_binds
|
26
|
+
return parse_ssl_bind if @config.fetch(:cert) && @config.fetch(:key)
|
27
|
+
|
28
|
+
host = @config.fetch(:host)
|
29
|
+
port = @config.fetch(:port)
|
30
|
+
@config.set(:Host, value: host) if host
|
31
|
+
@config.set(:Port, value: port) if port
|
32
|
+
end
|
33
|
+
|
34
|
+
def parse_ssl_bind
|
35
|
+
host = @config.fetch(:host, default: ::Puma::ConfigDefault::DefaultTCPHost)
|
36
|
+
port = @config.fetch(:port, default: ::Puma::ConfigDefault::DefaultTCPPort)
|
37
|
+
key = Pathname.new(@config.fetch(:key)).expand_path
|
38
|
+
cert = Pathname.new(@config.fetch(:cert)).expand_path
|
39
|
+
|
40
|
+
query = URI.encode_www_form(key: key, cert: cert)
|
41
|
+
@config.append("ssl://#{host}:#{port}?#{query}", to: :binds)
|
42
|
+
end
|
23
43
|
end
|
data/lib/servel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|