Skip to content

Instantly share code, notes, and snippets.

@jsierles
Created June 18, 2021 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsierles/57b52e71679a6b6fb1c7e3380e1cef45 to your computer and use it in GitHub Desktop.
Save jsierles/57b52e71679a6b6fb1c7e3380e1cef45 to your computer and use it in GitHub Desktop.
# Wrap Rails' built-in encrypted credentials to allow environment variable overrides
module Credential
class << self
def fetch(*args)
env_fetch(*args) || Rails.application.credentials.dig(*args)
end
def env_fetch(*args)
ENV[args.join("__").upcase]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment