Coder Social home page Coder Social logo

tomlenv's Introduction

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

tomlenv's People

Contributors

zaida04 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.