tomlenv
๐๏ธ About
Read and inject environment variables from a .toml file. Inspired by dotenv
๐ฅ Installation
You can install this package from NPM
npm install tomlenv
yarn add tomlenv
โก Usage
Unstructured env toml file
.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"
}
*/
Structured env toml file
.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"
}
*/
โ Contributing
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.
โ๏ธ LICENSE
Licensed under the MIT License