instance method creds

Ruby on Rails edge

Since edge

Signature

creds()

Returns an ActiveSupport::CombinedConfiguration instance that combines access to the encrypted credentials available via #credentials and keys used for the same purpose in ENV.

In the development environment, .env variables are also included, and looked up after ENV and before the encrypted credentials.

This allows application creds to be accessed in a uniform way regardless of where they’re being provided. You don’t have to change app code when you move from ENV to encrypted credentials or vice versa.

Examples:

Rails.app.creds.require(:db_password)
Rails.app.creds.require(:aws, :access_key_id)
Rails.app.creds.option(:cache_host, default: "cache-host-1")
Rails.app.creds.option(:cache_host, default: -> { HostProvider.cache })
Source
# File railties/lib/rails/application.rb, line 530
    def creds
      if Rails.env.development?
        @creds ||= ActiveSupport::CombinedConfiguration.new(envs, dotenvs, credentials)
      else
        @creds ||= ActiveSupport::CombinedConfiguration.new(envs, credentials)
      end
    end

Defined in railties/lib/rails/application.rb line 530 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Application

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