Star on GitHub - 5.8k

Ruby

Encrypt a .env file in Ruby with the Dotenvx gem, commit it safely, and load its secrets at runtime.

Install

Get the Dotenvx Ruby gem.
$ gem install dotenvx
And the CLI to encrypt files.
$ curl -sfS https://dotenvx.sh | sh

Encrypt

Encrypt your .env file.

$ dotenvx encrypt

Inject

Then inject your encrypted secrets at runtime.
require "dotenvx"

Dotenvx.load

puts "HELLO: #{ENV['HELLO']}"