Class: R2::Configuration
- Inherits:
-
Object
- Object
- R2::Configuration
- Defined in:
- lib/r2/configuration.rb
Overview
Centralized application configuration.
Settings are read directly from environment variables.
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initializes the configuration from environment variables.
Constructor Details
#initialize ⇒ Configuration
Initializes the configuration from environment variables.
R2_REGION is optional and defaults to auto when absent, which
is recommended for Cloudflare R2 endpoints.
23 24 25 26 27 28 29 |
# File 'lib/r2/configuration.rb', line 23 def initialize @access_key_id = fetch_required("R2_ACCESS_KEY_ID") @secret_access_key = fetch_required("R2_SECRET_ACCESS_KEY") @endpoint = fetch_required("R2_ENDPOINT") @bucket = fetch_required("R2_BUCKET") @region = ENV.fetch("R2_REGION", "auto") end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
10 11 12 |
# File 'lib/r2/configuration.rb', line 10 def access_key_id @access_key_id end |
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
10 11 12 |
# File 'lib/r2/configuration.rb', line 10 def bucket @bucket end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
10 11 12 |
# File 'lib/r2/configuration.rb', line 10 def endpoint @endpoint end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
10 11 12 |
# File 'lib/r2/configuration.rb', line 10 def region @region end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
10 11 12 |
# File 'lib/r2/configuration.rb', line 10 def secret_access_key @secret_access_key end |