Giter Club home page Giter Club logo

sync-dotenv's Introduction

sync ⚙️ dotenv

Keep your .env in sync with .env.example

Travis (.org) Coveralls github

Motivation

Projects often rely on environmental variables stored in a .env file to run... and because these variables sometimes contain sensitive data, we never add them to source control. Instead, these variables are added e.g. to a .env.example file so it's easy to get the project running for other developers. However, it's very easy to forget to update this file when a variable is added/updated in .env (during development). This can make it difficult for devs to get the project running (locally) because they rely on .env.example file to setup their environment (with their own configs).

Enter sync-dotenv 🔥

Description

sync-dotenv automates the process of keeping your .env in sync with .env.example.

Installation

$ npm install -g sync-dotenv

Install as a dev dependency (recommended)

$ npm install -D sync-dotenv

Usage

By default, sync-dotenv looks for a .env in your working directory and attempt to sync with .env.example when no argument is provided. Failure to find these files will cause the sync to fail.

$ sync-dotenv

For CLI options, use the --help flag

$ sync-dotenv --help

Examples

Sync (with .env.example) before every commit using husky

// package.json
{
  "scripts": {
    "env": "sync-dotenv"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run env",
    }
  }
}

Or with file other than .env.example

{
  "scripts": {
-    "env": "sync-dotenv"
+    "env": "sync-dotenv --sample .env.development"
  }
}

Related

  • parse-dotenv - zero dependency .env to javascript object parser

Contributors

Thanks goes to these wonderful people (emoji key):

Luqman Olushi O.
Luqman Olushi O.

💻 📖 🚧 📦 ⚠️
Bolaji Olajide
Bolaji Olajide

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

This project is licensed under MIT

sync-dotenv's People

Contributors

allcontributors[bot] avatar bolajiolajide avatar luqmanoop avatar

Watchers

 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.