A Ruby gem that enables seamless encryption, decryption, and editing of Rails dotenv files by integrating with the Sekrets gem for secure secrets management.
Seamlessly encrypt/decrypt/edit your rails Dotenv files with the help of the Sekrets gem
This tool is designed for Rails developers who need to securely manage environment variables and secrets without exposing them in source control. It allows encrypted dotenv files to be versioned safely while requiring only a secret key to decrypt and use the sensitive configuration data during runtime.
Ensure the `.sekrets.key` file is never committed to source control to maintain security. Use environment variables like SEKRETS_KEY for CI/CD environments to avoid storing keys in files. This tool relies on the Sekrets gem for encryption, so familiarity with Sekrets and dotenv is recommended for effective use.
Add `gem 'dotenv_sekrets'` to your application's Gemfile
Run `bundle` to install the gem
Alternatively, run `gem install dotenv_sekrets` to install directly
sekrets edit .env.enc
Edit the encrypted dotenv file using the Sekrets gem's editor
Create `.sekrets.key` file in Rails root
Store your secret key code used for encryption/decryption
Update `.gitignore` to ignore `.sekrets.key`
Prevent committing the secret key to source control
cat .env.enc
View the encrypted content of the dotenv file
Set environment variable `SEKRETS_KEY` in CI (e.g., Travis)
Provide the secret key via environment variable when `.sekrets.key` file is unavailable