load!

Load strictly and fail when an env file is missing

Ruby

Dotenvx.load!(*filenames)

Usage

Equivalent to load(*filenames, ignore: false, strict: true). Missing files raise Errno::ENOENT; other strict diagnostics raise Dotenvx::ParseError, whose code is available as error.code. Returns changed values.


require "dotenvx"
changed = Dotenvx.load!(".env.production")

markdown