Google Cloud ENV Secrets

Load Google Cloud Secrets into ENV.


Add this line to your application's Gemfile:

gem 'google_cloud_env_secrets'

And then execute:

$ bundle

Or install it yourself as:

$ gem install google_cloud_env_secrets


Configure this gem with environment vars:

Variable Description
GOOGLE_APPLICATION_CREDENTIALS Manually set path to Google Application Credentials.
GOOGLE_PROJECT Manually set the Google project. Automatically detected otherwise.
GOOGLE_SECRETS_PREFIX Only load secrets that start with prefix.
GOOGLE_SECRETS_FORCE Replace existing ENV vars with secret's value. Default true.

Google Secrets are available after the before_configuration hook. You can call GoogleCloudEnvSecrets.load if you need the ENV secrets sooner than that.

Required IAM Roles

Secret Manager Secret Accessor
Secret Manager Viewer