All Projects → codeshifu → Sync Dotenv

codeshifu / Sync Dotenv

Licence: mit
Keep your .env in sync with .env.example

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Sync Dotenv

Dotenv Kotlin
🗝️ Dotenv is a module that loads environment variables from a .env file
Stars: ✭ 326 (-17.05%)
Mutual labels:  environment-variables, dotenv
angular-cli-envvars
Example project for my article "Angular CLI and OS Environment Variables"
Stars: ✭ 56 (-85.75%)
Mutual labels:  dotenv, environment-variables
dart environment config
Environment specific config generator for Dart and Flutter applications during CI/CD builds
Stars: ✭ 87 (-77.86%)
Mutual labels:  dotenv, environment-variables
webpack-dotenv-plugin
Use dotenv with webpack.
Stars: ✭ 53 (-86.51%)
Mutual labels:  dotenv, environment-variables
ts-dotenv
Strongly-typed environment variables for Node.js
Stars: ✭ 18 (-95.42%)
Mutual labels:  dotenv, environment-variables
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (-91.6%)
Mutual labels:  dotenv, environment-variables
dotenv
Load .env files in crystal
Stars: ✭ 16 (-95.93%)
Mutual labels:  dotenv, environment-variables
React Native Dotenv
Load react native environment variables using import statements for multiple env files.
Stars: ✭ 190 (-51.65%)
Mutual labels:  environment-variables, dotenv
cypress-dotenv
Cypress plugin that enables compatability with dotenv
Stars: ✭ 47 (-88.04%)
Mutual labels:  dotenv, environment-variables
ngx-env
Easily inject environment variables into your Angular applications
Stars: ✭ 73 (-81.42%)
Mutual labels:  dotenv, environment-variables
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (-81.68%)
Mutual labels:  dotenv, environment-variables
envfile
Parse and write environment files with Node.js
Stars: ✭ 42 (-89.31%)
Mutual labels:  dotenv, environment-variables
dotenvy
Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents
Stars: ✭ 31 (-92.11%)
Mutual labels:  dotenv, environment-variables
checkdotenv
Verify environment variables presence for Node JS.
Stars: ✭ 12 (-96.95%)
Mutual labels:  dotenv, environment-variables
Env Var
Verification, sanitization, and type coercion for environment variables in Node.js
Stars: ✭ 201 (-48.85%)
Mutual labels:  environment-variables, dotenv
exenv
Exenv makes loading environment variables from external sources easy.
Stars: ✭ 35 (-91.09%)
Mutual labels:  dotenv, environment-variables
Dotenv Webpack
A secure webpack plugin that supports dotenv and other environment variables and only exposes what you choose and use.
Stars: ✭ 1,022 (+160.05%)
Mutual labels:  environment-variables, dotenv
Dotenv Java
🗝️ Dotenv is a no-dep, pure Java module that loads environment variables from a .env file
Stars: ✭ 72 (-81.68%)
Mutual labels:  environment-variables, dotenv
php-env
A small and fast .env loader for PHP
Stars: ✭ 19 (-95.17%)
Mutual labels:  dotenv, environment-variables
gconfigs
gConfigs - Config and Secret parser
Stars: ✭ 42 (-89.31%)
Mutual labels:  dotenv, environment-variables

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

Alternatively, you can use the --env and --sample flag to specify the source and destination file.

$ sync-dotenv --env foo/.env --sample bar/.env.example

Also, in the situation where you want to keep multiple files in sync with one source env file you can make use of the --samples flag specifying a globbing pattern to match:

$ sync-dotenv --env foo/.env --samples "env-samples/*"

# note: glob pattern should be provided as a string as shown above

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"
  }
}

Preserving variables in sample env

Sometimes you need to preserve certain variables in your example env file, you can optionally allow this by adding a sync-dotenv config in package.json like so

// package.json
"scripts": {
  ...
},
"sync-dotenv": {
  "preserve": ["CHANNEL"]
}

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

💻
Kizito Akhilome
Kizito Akhilome

💻 ⚠️ 📖

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

License

This project is licensed under MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].