Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jondotsoy/envctl

Manager envs files
https://github.com/jondotsoy/envctl

envs

Last synced: 24 days ago
JSON representation

Manager envs files

Awesome Lists containing this project

README

        

# envctl

To manager many env files.

**Example:**

```shell
# Initialize some environments
$ cat `FOO=biz` > .envs/staging
$ cat `FOO=taz` > .envs/rc

# Initialize the template file (Optional)
$ cat 'PORT=300\nFOO=' > .envs/template

# Now choice one
$ envctl use staging
```

## Install with brew

```shell
brew install jondotsoy/core/envctl
```

## Guide

1. Make your sources write many `.envs/` files.
2. Write your template on `.env.template`

**Example:**

```
# find .*
.env.template
.env.staging
.envs/rc1
.envs/rc2
```

3. Now run the next command `envctl use ` to write the final `.env` file and enjoy.

## Template

The template is used to make a `.env` file in the workspace directory. This file is filed with the `envctl use` command.

> For security, the `envctl use` command never adds variables to the final `.env` file.

**Templates locations:**

The `envctl use` find the template on the next alternatives:

- `.envs/template`
- `.env.template`
- `.env.sample`
- `.env.example`

If a template does not exist, it will try to use the `.env` file as a template. This strategy is so useful to update the template only on local.

## Sources

A source is used to fill a template and make the final `.env` file.

Those are valid sources:

- `.env.foo`
- `.foo.env`
- `.envs/foo`
- `.envs/.foo`
- `.envs/foo.env`
- `.envs/.foo.env`

Use that you prefer.

> Preferably, add `.envs/` on your `.gitignore` file to prevent pushing the secrets.