letsencrypt_standalone 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/le_standalone +4 -4
- data/lib/letsencrypt_standalone/base.rb +2 -2
- data/lib/letsencrypt_standalone/config.rb +17 -2
- data/lib/letsencrypt_standalone/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 532fe44ddaec7c12f52b3843963397ee53e25531
|
4
|
+
data.tar.gz: 5bad014ea44b654acf17119ce877937345fbe817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ddf0a7b703621ac5db86e33c9febf6e7397ebc861dfeb7fca1e6e54ee8bbe47ea773d4de9452e35cf2ab8fd81b2734e5a43b16997f4ba196a0b26bbe838a05c
|
7
|
+
data.tar.gz: f99d8e96ee809b6578859f7072a2386475a99253458669f00b715a0f4c7ed9ea696df4abeebeb11aef14fb5739c5334266939ce2c2f021a5262d77c1c8cdb1f9
|
data/exe/le_standalone
CHANGED
@@ -11,14 +11,14 @@ require 'letsencrypt_standalone'
|
|
11
11
|
logger = LetsencryptStandalone::Base.logger
|
12
12
|
|
13
13
|
# Default config
|
14
|
-
config_file = 'le_standalone.json'
|
15
14
|
options = {}
|
15
|
+
options[:config_file] = 'le_standalone.json'
|
16
16
|
|
17
17
|
OptionParser.new do |opts|
|
18
18
|
opts.banner = "le_standalone [options]"
|
19
19
|
|
20
20
|
opts.on("-c", "--config File", String, "Path to config file. Default: ./le_standalone.json") do |item|
|
21
|
-
config_file = item
|
21
|
+
options[:config_file] = item
|
22
22
|
end
|
23
23
|
|
24
24
|
opts.on("-p", "--port N", Integer, "Port. Default: 12080") do |port|
|
@@ -48,10 +48,10 @@ end.parse!
|
|
48
48
|
begin
|
49
49
|
|
50
50
|
# Config
|
51
|
-
config = LetsencryptStandalone::Config.new(config_file: config_file)
|
51
|
+
config = LetsencryptStandalone::Config.new(config_file: options[:config_file])
|
52
52
|
config.port = options[:port].nil? ? 12080 : options[:port]
|
53
53
|
config.add(domains: options[:domains]) if options[:domains]
|
54
|
-
|
54
|
+
p options
|
55
55
|
# Webrick conf
|
56
56
|
FileUtils.mkdir_p(config.www_root)
|
57
57
|
|
@@ -24,11 +24,11 @@ module LetsencryptStandalone
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def ssl_subdir
|
27
|
-
@ssl_subdir ||= LetsencryptStandalone::Config.
|
27
|
+
@ssl_subdir ||= LetsencryptStandalone::Config.ssl_subdir
|
28
28
|
end
|
29
29
|
|
30
30
|
def path
|
31
|
-
@path ||= LetsencryptStandalone::Config.
|
31
|
+
@path ||= LetsencryptStandalone::Config.config[:path]
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -2,10 +2,11 @@ require 'letsencrypt_standalone'
|
|
2
2
|
|
3
3
|
module LetsencryptStandalone
|
4
4
|
class Config < Base
|
5
|
+
@@config = nil
|
5
6
|
attr_accessor :config, :location, :port
|
6
7
|
def initialize(config_file: nil)
|
7
8
|
@location ||= config_file
|
8
|
-
|
9
|
+
@@config ||= JSON.parse(File.read(@location), :symbolize_names => true)
|
9
10
|
end
|
10
11
|
|
11
12
|
def output_dir
|
@@ -18,6 +19,10 @@ module LetsencryptStandalone
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
22
|
+
def config
|
23
|
+
@@config
|
24
|
+
end
|
25
|
+
|
21
26
|
def ssl_subdir
|
22
27
|
config[:ssl_subdir] || 'ssl_certs'
|
23
28
|
end
|
@@ -32,7 +37,7 @@ module LetsencryptStandalone
|
|
32
37
|
|
33
38
|
def add(domains:)
|
34
39
|
domains.each do |domain|
|
35
|
-
|
40
|
+
@@config[:domains] << {host: domain}
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
@@ -51,5 +56,15 @@ module LetsencryptStandalone
|
|
51
56
|
def write
|
52
57
|
File.new(location, 'w').write(JSON.pretty_generate(config))
|
53
58
|
end
|
59
|
+
|
60
|
+
class << self
|
61
|
+
def config
|
62
|
+
@@config
|
63
|
+
end
|
64
|
+
|
65
|
+
def ssl_subdir
|
66
|
+
@@config[:ssl_subdir] || 'ssl_certs'
|
67
|
+
end
|
68
|
+
end
|
54
69
|
end
|
55
70
|
end
|