Module: Creds
- Defined in:
- lib/creds.rb,
lib/creds/railtie.rb,
lib/creds/version.rb
Overview
The main module of rails-creds
Defined Under Namespace
Classes: MissingEnvError, MissingKeyError, Railtie
Constant Summary collapse
- EXAMPLE_CONFIG =
<<-YAML .strip_heredoc .freeze
- VERSION =
"0.5.1".freeze
Class Method Summary collapse
Class Method Details
.method_missing(mth, *args, &block) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/creds.rb', line 53 def self.method_missing(mth, *args, &block) # If this is set, we're likely building a Docker image and so just noop return nil if ENV["SECRET_KEY_BASE_DUMMY"] == "1" @cache ||= Rails.application.credentials[Rails.env].tap do |scoped| raise MissingEnvError.new(Rails.env) unless scoped.is_a?(Hash) raise MissingKeyError.new(mth, Rails.env) unless scoped.key?(mth.to_sym) scoped end @cache.fetch(mth.to_sym) end |