tomlenv
TypeScript icon, indicating that this package has built-in type declarations

1.0.0ย โ€ขย Publicย โ€ขย Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i tomlenv

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

10.3 kB

Total Files

15

Last publish

Collaborators

  • nico.03727