Class: Fly::Configuration
- Inherits:
-
Object
- Object
- Fly::Configuration
- Defined in:
- lib/fly-ruby/configuration.rb
Instance Attribute Summary collapse
-
#current_region ⇒ Object
Set the region where this instance of the application is deployed.
-
#database_host_env_var ⇒ Object
Returns the value of attribute database_host_env_var.
-
#database_port_env_var ⇒ Object
Returns the value of attribute database_port_env_var.
-
#database_url_env_var ⇒ Object
Environment variables related to the database connection.
-
#primary_region ⇒ Object
Set the region where the primary database lives, i.e “ams”.
-
#replay_http_methods ⇒ Object
Automatically replay these HTTP methods in the primary region.
-
#replay_threshold_cookie ⇒ Object
Cookie written and read by this middleware storing a UNIX timestamp.
-
#replay_threshold_in_seconds ⇒ Object
How long, in seconds, should all requests from the same client be replayed in the primary region after a successful write replay.
Instance Method Summary collapse
- #database_url ⇒ Object
- #eligible_for_activation? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fly-ruby/configuration.rb', line 27 def initialize self.primary_region = ENV["PRIMARY_REGION"] self.current_region = ENV["FLY_REGION"] self.replay_http_methods = ["POST", "PUT", "PATCH", "DELETE"] self.database_url_env_var = "DATABASE_URL" self.database_host_env_var = "DATABASE_HOST" self.database_port_env_var = "DATABASE_PORT" self. = "fly-replay-threshold" self.replay_threshold_in_seconds = 5 end |
Instance Attribute Details
#current_region ⇒ Object
Set the region where this instance of the application is deployed
4 5 6 |
# File 'lib/fly-ruby/configuration.rb', line 4 def current_region @current_region end |
#database_host_env_var ⇒ Object
Returns the value of attribute database_host_env_var.
16 17 18 |
# File 'lib/fly-ruby/configuration.rb', line 16 def database_host_env_var @database_host_env_var end |
#database_port_env_var ⇒ Object
Returns the value of attribute database_port_env_var.
17 18 19 |
# File 'lib/fly-ruby/configuration.rb', line 17 def database_port_env_var @database_port_env_var end |
#database_url_env_var ⇒ Object
Environment variables related to the database connection. These get by this middleware in secondary regions, so they must be interpolated rather than defined directly in the configuration.
15 16 17 |
# File 'lib/fly-ruby/configuration.rb', line 15 def database_url_env_var @database_url_env_var end |
#primary_region ⇒ Object
Set the region where the primary database lives, i.e “ams”
7 8 9 |
# File 'lib/fly-ruby/configuration.rb', line 7 def primary_region @primary_region end |
#replay_http_methods ⇒ Object
Automatically replay these HTTP methods in the primary region
10 11 12 |
# File 'lib/fly-ruby/configuration.rb', line 10 def replay_http_methods @replay_http_methods end |
#replay_threshold_cookie ⇒ Object
Cookie written and read by this middleware storing a UNIX timestamp. Requests arriving before this timestamp will be replayed in the primary region.
21 22 23 |
# File 'lib/fly-ruby/configuration.rb', line 21 def @replay_threshold_cookie end |
#replay_threshold_in_seconds ⇒ Object
How long, in seconds, should all requests from the same client be replayed in the primary region after a successful write replay
25 26 27 |
# File 'lib/fly-ruby/configuration.rb', line 25 def replay_threshold_in_seconds @replay_threshold_in_seconds end |
Instance Method Details
#database_url ⇒ Object
38 39 40 |
# File 'lib/fly-ruby/configuration.rb', line 38 def database_url ENV[database_url_env_var] end |
#eligible_for_activation? ⇒ Boolean
42 43 44 |
# File 'lib/fly-ruby/configuration.rb', line 42 def eligible_for_activation? database_url && primary_region && current_region end |