Read and inject environment variables from a .toml file. Inspired by dotenv
You can install this package from NPM
npm install tomlenv
yarn add tomlenv
.env.toml
test = "TESTING_VAR_1"
test2 = "TESTING_VAR_2"
index.js
import * as tomlenv from 'tomlenv';
tomlenv.config({ path: '../path/to/some/.env.toml' });
console.log(process.env);
/*
{
...,
test: "TESTING_VAR_1",
test2: "TESTING_VAR_2"
}
*/
.env.toml
[env.prod]
test = "TESTING_VAR_1_PROD"
test2 = "TESTING_VAR_2_PROD"
[env.dev]
test = "TESTING_VAR_1_DEV"
test2 = "TESTING_VAR_2_DEV"
index.js
import * as tomlenv from 'tomlenv';
tomlenv.config({ path: '../path/to/some/.env.toml', environment: 'dev' });
console.log(process.env);
/*
{
...,
test: "TESTING_VAR_1_DEV",
test2: "TESTING_VAR_2_DEV"
}
*/
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Please ensure any and all commits pass our tests, linting, and build steps as described in the package.json. Our husky/commitlint commit hooks should take care of this for you automatically.
Licensed under the MIT License