Module: Cre
- Defined in:
- lib/cre.rb,
lib/cre/railtie.rb,
lib/cre/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
'2'
Class Method Summary collapse
-
.dig(env = Rails.env, credential) ⇒ Object
Fetching Rails encrypted credentials with: ‘Rails.application.credentials.dig(:environment, :credential)` Is too long for my taste.
Class Method Details
.dig(env = Rails.env, credential) ⇒ Object
Fetching Rails encrypted credentials with:
`Rails.application.credentials.dig(:environment, :credential)`
Is too long for my taste. Using Cre.dig is a lot shorter:
`Cre.dig(:environment, :credential)`
By default Rails.env finds the default environment for us when none is specified and it is called with the credential only:
`Cre.dig(:password)`
The dig method here is just an aesthetic thing to keep us in context. TODO: Add support for deeply nested credentials.
16 17 18 19 20 21 |
# File 'lib/cre.rb', line 16 def self.dig(env = Rails.env, credential) Rails.application.credentials.dig( env.to_sym, credential.to_sym ) end |