Class: Runbox::Configuration
- Inherits:
-
Object
- Object
- Runbox::Configuration
- Defined in:
- lib/runbox/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 |
# File 'lib/runbox/configuration.rb', line 7 def initialize @url = ENV.fetch("RUNBOX_URL", "http://localhost:8080") @api_key = ENV.fetch("RUNBOX_API_KEY", nil) @timeout = 120 # HTTP timeout (longer than execution timeout) @open_timeout = 10 end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/runbox/configuration.rb', line 5 def api_key @api_key end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/runbox/configuration.rb', line 5 def open_timeout @open_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/runbox/configuration.rb', line 5 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/runbox/configuration.rb', line 5 def url @url end |
Instance Method Details
#validate! ⇒ Object
14 15 16 17 |
# File 'lib/runbox/configuration.rb', line 14 def validate! raise ConfigurationError, "API key is required" if api_key.nil? || api_key.empty? raise ConfigurationError, "URL is required" if url.nil? || url.empty? end |