Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

centralenv

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

centralenv

Central management tool for dotenv (.env)

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

centralenv

Source will be on Github soon... (when finish separating from monorepo)

Motivation

That's just I wanted this function.

Documentation

NOTE:

  • centralenv overwrite output file. You will lost your data if output file already exist.
  • centralenv is not tested. Please use at your own risk.
  • Might not work on Windows. Please let me know if it works or not, since I don't have one.

Install

You can use centralenv for any language if you have nodejs installed on your computer.
Not only for javascript project.

npm i centralenv -D
yarn add -D centralenv

Usage:

Options:

optionsColumn B
-p, --projectName.env.<projectName>.<stage>
-h, --helpShow help
--sourceFile[default: ".env"]
--sourceDir[default: "$HOME"]
-k, --keySourceFile[default: ".env.example"]
-s, --stages[default: ["development","production","test"]]

Simple

  • centralenv -s =>

    • .env
  • Source file ${sourceDir}/${sourceFile} => default: $HOME/.env

NAME=UNCHI
EMOJI=💩
CONDITION=VERY_GOOD
PRICE=1010000$
  • <projectRoot>/.env.sample
NAME=N
EMOJI=
CONDITION=?
PRICE=100
NOT_EXISTING_KEY=SomeValue
  • => <projectRoot>/.env
NAME=UNCHI
EMOJI=💩
CONDITION=VERY_GOOD
PRICE=1010000$
NOT_EXISTING_KEY=

Multiple Stages: centralenv

  • centralenv =>
    • output
      • .env.development
      • .env.production
      • .env.test
  • centralenv -s dev -s prod -s someother =>
    • output
      • .env.dev
      • .env.prod
      • .env.someother

.gitignore

.env**
!.env.example

Todo

  • basic functions
  • support stages ['development', 'production', 'test']
  • command line args
  • log output, by relative path, from project root.
  • generate publish script, to avoid unnecessary devDependencies to be installed.
  • prefix ( eg: "API_SERVER_" )
  • encryption / decryption
  • connect git repo ( using as source with encryption, like fastlane )

CHANGE LOG

1.0.4

BREAKING CHANGE

  • defaultSourceDir was changed from $HOME => $HOME/.env for convenience.
  • Support environment variables with prefix "CENTRALENV".

if you are already using < 1.0.3, you can use same way by doing follows.

echo 'export CENTRALENV_SOURCE_DIR=~/.env ' >> ~/.bash_profile

Keywords

env

FAQs

Package last updated on 12 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts