Class: Conductor::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/conductor/configuration.rb

Overview

Configuration for Conductor client

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

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_tokenObject

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_timeObject

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_minObject

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_settingsObject

Returns the value of attribute authentication_settings.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def authentication_settings
  @authentication_settings
end

#base_urlObject

Returns the value of attribute base_url.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def base_url
  @base_url
end

#cert_fileObject

Returns the value of attribute cert_file.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def cert_file
  @cert_file
end

#debugObject

Returns the value of attribute debug.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def debug
  @debug
end

#hostObject (readonly)

Returns the value of attribute host.



20
21
22
# File 'lib/conductor/configuration.rb', line 20

def host
  @host
end

#key_fileObject

Returns the value of attribute key_file.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def key_file
  @key_file
end

#proxyObject

Returns the value of attribute proxy.



16
17
18
# File 'lib/conductor/configuration.rb', line 16

def proxy
  @proxy
end

#server_api_urlObject

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_certObject

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_hostObject (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_sslObject

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

Returns:

  • (Boolean)


45
46
47
# File 'lib/conductor/configuration.rb', line 45

def auth_configured?
  @authentication_settings&.configured? || false
end

#auth_tokenObject



58
59
60
# File 'lib/conductor/configuration.rb', line 58

def auth_token
  self.class.auth_token
end

#auth_token_ttl_msecObject



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_urlObject

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_timeObject



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