{"title":"Encrypt","description":"","section":"cli","version":"v1.5","path":"cli/encrypt","canonical_url":"https://amberframework.org/docs/v1.5/cli/encrypt","markdown_url":"https://amberframework.org/docs/v1.5/cli/encrypt.md","inherited":true,"content_markdown":"# Encrypt\n\nThe `encrypt` command allows you to encrypt and edit your environment settings. This allows you to store production secrets in your repo safely.\n\nHere is a list of the commands available:\n\n```text\namber encrypt [OPTIONS] [ENV]\n\nArguments:\n  ENV  Environment settings to encrypt (default: production)\n\nOptions:\n  -e, --editor  Prefered Editor: [vim, nano, pico, etc]\n                (default: vim)\n  --noedit      Skip editing and just encrypt\n```\n\n## Editing Encrypted Files\n\nThe command`amber encrypt production` will use the secret key in .`encryption_key` or `ENV[AMBER_ENCRYPTION_KEY]` to decrypt `config/environments/.production.enc` and open it in your favorite editor.\n\nWhen you save and exit it will encrypt again.\n\n![Amber Encrypt Demo](https://raw.githubusercontent.com/amberframework/site-assets/master/videos/amber_encrypt.gif)\n\n## Encrypt unencrypted environment settings\n\n`amber encrypt development` will encrypt `config/environments/development.yml` using same keys as above.\n\nEditor will be opened if file is already encrypted.\n\n`amber encrypt development --noedit` will encrypt file if unencrypted but do nothing if it's already encrypted. Editor will not be opened.\n\n{% hint style=\"info\" %}\nProduction is encrypted by default.\n{% endhint %}\n\n## Note about Amber Encryption Key\n\nKeep track of the values of `.encryption_key` or `ENV[AMBER_ENCRYPTION_KEY]`. If you lose these you will not be able to decrypt an encrypted file.\n\nWhen a new project is created the file `.encryption_key` is created with a random key. This is added to `gitignore` by default as it should never be added to your repo.\n\nIf you need to encrypt or decrypt on another development box or server you will need to manually move `.encryption_key` or set the value of `ENV[AMBER_ENCRYPTION_KEY]` on that computer.\n\nIf your server can't read your encrypted settings it will use the default ones."}