1.0.0 • Published 2 years ago

tomlenv v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

tomlenv

GitHub npm CI workflows

🗒️ 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