Class: Fal::Configuration
- Inherits:
-
Object
- Object
- Fal::Configuration
- Defined in:
- lib/fal/configuration.rb
Overview
Holds configuration for the Fal client.
Constant Summary collapse
- DEFAULT_TIMEOUT =
300- DEFAULT_POLL_INTERVAL =
0.5
- RUN_HOST =
"fal.run"- QUEUE_HOST =
"queue.fal.run"
Instance Attribute Summary collapse
- #api_key ⇒ Object
-
#poll_interval ⇒ Object
Returns the value of attribute poll_interval.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #queue_url ⇒ Object
- #run_url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 |
# File 'lib/fal/configuration.rb', line 20 def initialize @api_key = ENV.fetch("FAL_KEY", nil) @timeout = DEFAULT_TIMEOUT @poll_interval = DEFAULT_POLL_INTERVAL end |
Instance Attribute Details
#api_key ⇒ Object
26 27 28 |
# File 'lib/fal/configuration.rb', line 26 def api_key @api_key or raise ConfigurationError, "API key not configured. Set FAL_KEY or call Fal.configure" end |
#poll_interval ⇒ Object
Returns the value of attribute poll_interval.
12 13 14 |
# File 'lib/fal/configuration.rb', line 12 def poll_interval @poll_interval end |
#timeout ⇒ Object
Returns the value of attribute timeout.
12 13 14 |
# File 'lib/fal/configuration.rb', line 12 def timeout @timeout end |
Instance Method Details
#queue_url ⇒ Object
34 35 36 |
# File 'lib/fal/configuration.rb', line 34 def queue_url "https://#{QUEUE_HOST}" end |
#run_url ⇒ Object
30 31 32 |
# File 'lib/fal/configuration.rb', line 30 def run_url "https://#{RUN_HOST}" end |