Created
July 1, 2025 22:37
-
-
Save dpaluy/24b6af4336bf0915bda157edfee09cbb to your computer and use it in GitHub Desktop.
Merge rails secrets with ENV
This file contains hidden or 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
module CredentialsDemo | |
class Application < Rails::Application | |
creds = credentials[Rails.env.to_sym] | |
.with_indifferent_access | |
.transform_keys(&:upcase) | |
.transform_values(&:to_s) | |
ENV.merge! creds.merge(ENV) | |
end | |
end | |
# usage: | |
# ENV['MY_SECRET'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment