Class: Conductor::Configuration
- Inherits:
-
Object
- Object
- Conductor::Configuration
- Defined in:
- lib/conductor/configuration.rb
Overview
Configuration for Conductor client
Class Attribute Summary collapse
-
.auth_token ⇒ Object
Returns the value of attribute auth_token.
-
.token_update_time ⇒ Object
Returns the value of attribute token_update_time.
Instance Attribute Summary collapse
-
#auth_token_ttl_min ⇒ Object
Returns the value of attribute auth_token_ttl_min.
-
#authentication_settings ⇒ Object
Returns the value of attribute authentication_settings.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#cert_file ⇒ Object
Returns the value of attribute cert_file.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#key_file ⇒ Object
Returns the value of attribute key_file.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#server_api_url ⇒ Object
Returns the value of attribute server_api_url.
-
#ssl_ca_cert ⇒ Object
Returns the value of attribute ssl_ca_cert.
-
#ui_host ⇒ Object
readonly
Returns the value of attribute ui_host.
-
#verify_ssl ⇒ Object
Returns the value of attribute verify_ssl.
Instance Method Summary collapse
- #auth_configured? ⇒ Boolean
- #auth_token ⇒ Object
- #auth_token_ttl_msec ⇒ Object
- #disable_auth! ⇒ Object
-
#initialize(base_url: nil, server_api_url: nil, debug: false, authentication_settings: nil, auth_key: nil, auth_secret: nil, auth_token_ttl_min: 45, verify_ssl: true) ⇒ Configuration
constructor
A new instance of Configuration.
-
#server_url ⇒ Object
Alias for server URL (used in some places).
- #token_update_time ⇒ Object
- #update_token(token) ⇒ Object
Constructor Details
#initialize(base_url: nil, server_api_url: nil, debug: false, authentication_settings: nil, auth_key: nil, auth_secret: nil, auth_token_ttl_min: 45, verify_ssl: true) ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/conductor/configuration.rb', line 22 def initialize(base_url: nil, server_api_url: nil, debug: false, authentication_settings: nil, auth_key: nil, auth_secret: nil, auth_token_ttl_min: 45, verify_ssl: true) @debug = debug @verify_ssl = verify_ssl @ssl_ca_cert = nil @cert_file = nil @key_file = nil @proxy = nil @auth_token_ttl_min = auth_token_ttl_min # Resolve server URL @host = resolve_host(server_api_url, base_url) @ui_host = resolve_ui_host # Resolve authentication @authentication_settings = resolve_auth_settings(authentication_settings, auth_key, auth_secret) end |
Class Attribute Details
.auth_token ⇒ Object
Returns the value of attribute auth_token.
13 14 15 |
# File 'lib/conductor/configuration.rb', line 13 def auth_token @auth_token end |
.token_update_time ⇒ Object
Returns the value of attribute token_update_time.
13 14 15 |
# File 'lib/conductor/configuration.rb', line 13 def token_update_time @token_update_time end |
Instance Attribute Details
#auth_token_ttl_min ⇒ Object
Returns the value of attribute auth_token_ttl_min.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def auth_token_ttl_min @auth_token_ttl_min end |
#authentication_settings ⇒ Object
Returns the value of attribute authentication_settings.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def authentication_settings @authentication_settings end |
#base_url ⇒ Object
Returns the value of attribute base_url.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def base_url @base_url end |
#cert_file ⇒ Object
Returns the value of attribute cert_file.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def cert_file @cert_file end |
#debug ⇒ Object
Returns the value of attribute debug.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def debug @debug end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
20 21 22 |
# File 'lib/conductor/configuration.rb', line 20 def host @host end |
#key_file ⇒ Object
Returns the value of attribute key_file.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def key_file @key_file end |
#proxy ⇒ Object
Returns the value of attribute proxy.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def proxy @proxy end |
#server_api_url ⇒ Object
Returns the value of attribute server_api_url.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def server_api_url @server_api_url end |
#ssl_ca_cert ⇒ Object
Returns the value of attribute ssl_ca_cert.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def ssl_ca_cert @ssl_ca_cert end |
#ui_host ⇒ Object (readonly)
Returns the value of attribute ui_host.
20 21 22 |
# File 'lib/conductor/configuration.rb', line 20 def ui_host @ui_host end |
#verify_ssl ⇒ Object
Returns the value of attribute verify_ssl.
16 17 18 |
# File 'lib/conductor/configuration.rb', line 16 def verify_ssl @verify_ssl end |
Instance Method Details
#auth_configured? ⇒ Boolean
45 46 47 |
# File 'lib/conductor/configuration.rb', line 45 def auth_configured? @authentication_settings&.configured? || false end |
#auth_token ⇒ Object
58 59 60 |
# File 'lib/conductor/configuration.rb', line 58 def auth_token self.class.auth_token end |
#auth_token_ttl_msec ⇒ Object
41 42 43 |
# File 'lib/conductor/configuration.rb', line 41 def auth_token_ttl_msec @auth_token_ttl_min * 60 * 1000 end |
#disable_auth! ⇒ Object
49 50 51 |
# File 'lib/conductor/configuration.rb', line 49 def disable_auth! @authentication_settings = nil end |
#server_url ⇒ Object
Alias for server URL (used in some places)
67 68 69 |
# File 'lib/conductor/configuration.rb', line 67 def server_url @host end |
#token_update_time ⇒ Object
62 63 64 |
# File 'lib/conductor/configuration.rb', line 62 def token_update_time self.class.token_update_time end |
#update_token(token) ⇒ Object
53 54 55 56 |
# File 'lib/conductor/configuration.rb', line 53 def update_token(token) self.class.auth_token = token self.class.token_update_time = (Time.now.to_f * 1000).to_i end |