# centralenv

> Central management tool for dotenv (.env)

Latest version **1.0.6** (published 2019-07-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install centralenv
pnpm add centralenv
yarn add centralenv
bun add centralenv
```

Provides the command `centralenv`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-07-12 |
| First published | 2019-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ken Owada |
| Maintainers | ken0x0a |
| Keywords | env, environment, variable, dotenv, monorepo, workspace, docker |

## Links

- npm: https://www.npmjs.com/package/centralenv
- Repository: https://github.com/ken0x0a/centralenv
- Homepage: https://github.com/ken0x0a/centralenv/tree/master/packages/central-env#readme
- Issues: https://github.com/ken0x0a/centralenv/issues
- npm.io page: https://npm.io/package/centralenv

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [yargs](https://npm.io/package/yargs.md) ^13.2.4

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2019-07-12
- 1.0.5 — 2019-01-15
- 1.0.4 — 2019-01-15
- 1.0.3 — 2019-01-11
- 1.0.2 — 2019-01-10

## README

# centralenv

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

- [Motivation](#motivation)
- [Documentation](#documentation)
  - [Install](#install)
  - [Usage:](#usage)
    - [Simple](#simple)
    - [Multiple Stages: `centralenv`](#multiple-stages-centralenv)
  - [.gitignore](#gitignore)
- [Todo](#todo)
- [CHANGE LOG](#change-log)
  - [1.0.4](#104)

## 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.

```sh
npm i centralenv -D
yarn add -D centralenv
```

### Usage:

Options:

| options             | Column B                                       |
| ------------------- | ---------------------------------------------- |
| -p, --projectName   | .env.\<projectName\>.\<stage\>                 |
| -h, --help          | Show 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

```dotenv
NAME=UNCHI
EMOJI=💩
CONDITION=VERY_GOOD
PRICE=1010000$
```

- \<projectRoot\>/.env.sample

```dotenv
NAME=N
EMOJI=
CONDITION=?
PRICE=100
NOT_EXISTING_KEY=SomeValue
```

- => \<projectRoot\>/.env

```dotenv
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

- [x] basic functions
- [x] support stages ['development', 'production', 'test']
- [x] command line args
- [ ] log output, by relative path, from project root.
- [x] 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.

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

---
_Source: https://npm.io/package/centralenv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
