Class: Spurious::Server::Options
- Inherits:
-
Object
- Object
- Spurious::Server::Options
- Defined in:
- lib/spurious/server/options.rb
Instance Attribute Summary collapse
-
#cert_path ⇒ Object
readonly
Returns the value of attribute cert_path.
-
#docker_api ⇒ Object
readonly
Returns the value of attribute docker_api.
-
#docker_full_path ⇒ Object
readonly
Returns the value of attribute docker_full_path.
-
#docker_host ⇒ Object
readonly
Returns the value of attribute docker_host.
-
#docker_port ⇒ Object
readonly
Returns the value of attribute docker_port.
-
#read_timeout ⇒ Object
readonly
Returns the value of attribute read_timeout.
-
#server_ip ⇒ Object
readonly
Returns the value of attribute server_ip.
-
#server_port ⇒ Object
readonly
Returns the value of attribute server_port.
-
#write_timeout ⇒ Object
readonly
Returns the value of attribute write_timeout.
Instance Method Summary collapse
-
#initialize(env) ⇒ Options
constructor
A new instance of Options.
- #ssl_docker_host ⇒ Object
Constructor Details
#initialize(env) ⇒ Options
Returns a new instance of Options.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/spurious/server/options.rb', line 6 def initialize(env) @docker_host = env['DOCKER_HOST'].nil? ? 'localhost' : env['DOCKER_HOST'][/\/\/([0-9a-z\.]+):/,1] @docker_port = env['DOCKER_HOST'].nil? ? nil : env['DOCKER_HOST'][/:([0-9]+)/,1] @docker_api = !env['DOCKER_HOST'].nil? @server_port = env.fetch('SPURIOUS_SERVER_PORT', 4590) @server_ip = env.fetch('SPURIOUS_SERVER_IP', '0.0.0.0') @write_timeout = env.fetch('EXCON_WRITE_TIMEOUT', 30000) @read_timeout = env.fetch('EXCON_READ_TIMEOUT', 30000) @cert_path = env.fetch('DOCKER_CERT_PATH', nil) setup_ssl if @cert_path end |
Instance Attribute Details
#cert_path ⇒ Object (readonly)
Returns the value of attribute cert_path.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def cert_path @cert_path end |
#docker_api ⇒ Object (readonly)
Returns the value of attribute docker_api.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def docker_api @docker_api end |
#docker_full_path ⇒ Object (readonly)
Returns the value of attribute docker_full_path.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def docker_full_path @docker_full_path end |
#docker_host ⇒ Object (readonly)
Returns the value of attribute docker_host.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def docker_host @docker_host end |
#docker_port ⇒ Object (readonly)
Returns the value of attribute docker_port.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def docker_port @docker_port end |
#read_timeout ⇒ Object (readonly)
Returns the value of attribute read_timeout.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def read_timeout @read_timeout end |
#server_ip ⇒ Object (readonly)
Returns the value of attribute server_ip.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def server_ip @server_ip end |
#server_port ⇒ Object (readonly)
Returns the value of attribute server_port.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def server_port @server_port end |
#write_timeout ⇒ Object (readonly)
Returns the value of attribute write_timeout.
4 5 6 |
# File 'lib/spurious/server/options.rb', line 4 def write_timeout @write_timeout end |
Instance Method Details
#ssl_docker_host ⇒ Object
18 19 20 |
# File 'lib/spurious/server/options.rb', line 18 def ssl_docker_host "https://#{docker_host}:#{docker_port}" end |