class EnvConfiguration

Ruby on Rails edge

Since edge

Provide a better interface for accessing configuration options stored in ENV. Keys are accepted as symbols and turned into upcased strings. Nesting is provided by double underscores.

This interface mirrors what is used for ActiveSupport::EncryptedConfiguration and thus allows both to serve as interchangeable backends for Rails.app.credentials.

Examples:

require(:db_host)                                   # => ENV.fetch("DB_HOST")
require(:database, :host)                           # => ENV.fetch("DATABASE__HOST")
option(:database, :host)                            # => ENV["DATABASE__HOST"]
option(:debug, default: "true")                     # => ENV.fetch("DEBUG", "true")
option(:database, :host, default: -> { "missing" }) # => ENV.fetch("DATABASE__HOST") { "missing" }

Inherits from

Object

Methods (defined here)

Private methods (1)

Show private methods Implementation detail — not part of the public API.

Methods (inherited)

From Object (17)
From ActiveSupport::NumericWithFormat (2)

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close