AbstractBrain Answers About us →

How to edit Rails credentials (full command)

Question

I use Rails credentials for managing secrets in a secure way.

Now I need to change some secret credentials for the production environment.

Can you provide the full command for editing the file (config/credentials/production.yml.enc)?

Answer

This is the command:

EDITOR="atom --wait" bin/rails credentials:edit --environment production

Note that you need to replace EDITOR with your actual text editor, like atom, code, vi, vim, etc.

Then you can edit the file contents and save.

Finally you should see a confirmation message that says that the file has been saved and encrypted.