rest_shifter 0.0.24 → 0.0.25
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/lib/rest_shifter/commands/main.rb +10 -1
- data/lib/rest_shifter/commands/start.rb +8 -0
- data/lib/rest_shifter/shifter.rb +3 -3
- data/lib/rest_shifter/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: bcfeac378d6283957aa13e0741864fecfba830ea
|
4
|
+
data.tar.gz: ca958fb8a527a5f1613b3b059cc4a7831b64f1b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043d1d2526447552cfd7377312d95caa454bf4660ab0abcc5f0fcb3df408b6c7ed351d65b62104b99ea352d62b5a608cbf7021ee282672080c9397c6c0886f98
|
7
|
+
data.tar.gz: b196c806b2a57d8e5f0fbf3641d6d761050ddd5ed99cecb741b1caabed96df9e4ad24c4072673ff825c44b91daf22080922ca35b9ead07ae0fbff109d6ae1fc3
|
@@ -11,8 +11,17 @@ class RestShifter::Commands::Main
|
|
11
11
|
port = "8080" unless !port.to_s.empty?
|
12
12
|
RestShifter::Commands::Start.run port
|
13
13
|
exit 0
|
14
|
+
when "-X", "--start-secure-no-cert", "start-secure-no-cert"
|
15
|
+
port = args.shift
|
16
|
+
port = "4443" unless !port.to_s.empty?
|
17
|
+
RestShifter::Commands::Start.run_secure_no_cert port
|
18
|
+
exit 0
|
14
19
|
when "-S", "--start-secure", "start-secure"
|
15
|
-
|
20
|
+
port = args.shift
|
21
|
+
cert = args.shift
|
22
|
+
key = args.shift
|
23
|
+
port = "4443" unless !port.to_s.empty?
|
24
|
+
RestShifter::Commands::Start.run_secure port, cert, key
|
16
25
|
exit 0
|
17
26
|
when "-c", "--create", "create"
|
18
27
|
RestShifter::Commands::Create.run
|
@@ -8,6 +8,14 @@ class RestShifter::Commands::Start
|
|
8
8
|
Shifter.run!
|
9
9
|
end
|
10
10
|
|
11
|
+
def run_secure_no_cert(port=ARGV)
|
12
|
+
|
13
|
+
prepare_server
|
14
|
+
Shifter.use Rack::SSL
|
15
|
+
Shifter.set :bind, '0.0.0.0'
|
16
|
+
Shifter.run_ssl! port.to_i, File.join(File.dirname(__FILE__), "../../fake_certs/localhost.cert"), File.join(File.dirname(__FILE__), "../../fake_certs/localhost.key")
|
17
|
+
end
|
18
|
+
|
11
19
|
def run_secure(args=ARGV)
|
12
20
|
port = args.shift
|
13
21
|
crt = args.shift
|
data/lib/rest_shifter/shifter.rb
CHANGED
@@ -7,16 +7,16 @@ module RestShifter; end
|
|
7
7
|
|
8
8
|
class Shifter < Sinatra::Base
|
9
9
|
|
10
|
-
def self.run_ssl! port,
|
10
|
+
def self.run_ssl! port, cert, key
|
11
11
|
server_options = {
|
12
12
|
:Port => port.to_i,
|
13
13
|
:Host => bind,
|
14
14
|
:SSLEnable => true,
|
15
|
-
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open(
|
15
|
+
:SSLCertificate => OpenSSL::X509::Certificate.new(File.open(cert).read),
|
16
16
|
:SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(key).read),
|
17
17
|
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE
|
18
18
|
}
|
19
|
-
|
19
|
+
|
20
20
|
Rack::Handler::WEBrick.run self, server_options do |server|
|
21
21
|
[:INT, :TERM].each { |sig| trap(sig) { server.stop } }
|
22
22
|
server.threaded = settings.threaded if server.respond_to? :threaded=
|
data/lib/rest_shifter/version.rb
CHANGED