Created
June 18, 2021 22:57
-
-
Save jsierles/57b52e71679a6b6fb1c7e3380e1cef45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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