Skip to content

Instantly share code, notes, and snippets.

@dpaluy
Created July 1, 2025 22:37
Show Gist options
  • Save dpaluy/24b6af4336bf0915bda157edfee09cbb to your computer and use it in GitHub Desktop.
Save dpaluy/24b6af4336bf0915bda157edfee09cbb to your computer and use it in GitHub Desktop.
Merge rails secrets with ENV
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