0.0
The project is in a healthy, maintained state
[dotenvx.com] a better dotenv–from the creator of `dotenv`
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0

Runtime

= 4.0.0
>= 5.0
 Project Readme

dotenvx

a secure dotenv–from the creator of dotenv.

dotenvx loads plaintext and encrypted dotenv files through the shared dotenvx-primitives Rust implementation. The native extension is bundled in the gem; users do not need Node.js, a dotenvx CLI, or a Rust toolchain.

Install

gem install dotenvx

Or add it to a Gemfile:

gem "dotenvx"

Use

Load .env from the current directory:

require "dotenvx/load"

Or load explicitly:

require "dotenvx"

Dotenvx.load
Dotenvx.load(".env.local", ".env")

Existing environment variables win by default:

Dotenvx.load(".env")

To replace existing values:

Dotenvx.load(".env", overwrite: true)
Dotenvx.overwrite(".env")

Parse without changing ENV:

values = Dotenvx.parse(".env")

Raise when a file is missing:

Dotenvx.load!(".env")

Require configuration keys:

Dotenvx.require_keys("DATABASE_URL", "SECRET_KEY")

Encrypted values are decrypted automatically when the matching private key is available through the process environment, <filename>.keys, or .env.keys.

Native platforms

Tagged releases publish variants of the same dotenvx gem for:

  • Linux x86-64
  • Linux ARM64
  • macOS Intel
  • macOS Apple Silicon
  • Windows x64

RubyGems selects the correct variant during gem install dotenvx.