Edit Rails Credentials
To edit credentials in Rails using sublime run this, and it will open the credentials file in sublime.
Assuming we've set up credentials for each of our environements (as we've done in ZipMessage), we'll need to add the credentials to each one separately, using these commands:
Edit credentials for development:
EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit --environment developmentEdit credentials for test:
EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit --environment testEdit credentials for staging:
EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit --environment stagingEdit credentials for production:
EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit --environment productionOnce saved and the file is closed, those credentials will be encrypted and saved.
You can then reference the credentials like this:
Rails.application.credentials.aws[:AWS_SITEMAP_BUCKET]Last updated