Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madcoda/dotenv-shell
Use Dotenv in everything
https://github.com/madcoda/dotenv-shell
Last synced: about 2 months ago
JSON representation
Use Dotenv in everything
- Host: GitHub
- URL: https://github.com/madcoda/dotenv-shell
- Owner: madcoda
- License: mit
- Created: 2016-03-12T09:57:15.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-30T05:06:03.000Z (almost 4 years ago)
- Last Synced: 2024-11-01T19:35:59.414Z (about 2 months ago)
- Language: Shell
- Size: 16.6 KB
- Stars: 73
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/madcoda/dotenv-shell.svg?branch=improve_value)](https://travis-ci.org/madcoda/dotenv-shell)
# dotenv-shell
Use Dotenv in everything
## Install
```
curl https://raw.githubusercontent.com/madcoda/dotenv-shell/master/dotenv.sh > /usr/local/bin/dotenv
chmod +x /usr/local/bin/dotenv
```## Usage
```sh
# Run command
dotenv run_my_command param1 param2# Export to current shell
. dotenv# chain local secrets in .env with defaults in defaults.env
DOTENV_DEFAULT=defaults.env dotenv run_my_command param1 param2# change name of DOTENV_FILE
DOTENV_FILE=prod.env dotenv run_my_command param1 param2# change name of DOTENV_FILE and use defaults
DOTENV_FILE=prod.env DOTENV_DEFAULT=defaults.env dotenv run_my_command param1 param2
```In a Makefile
```
# Just one command
dotenv run_my_command# All commands
SHELL := DOTENV_DEFAULT=default.env dotenv /bin/sh
```## Tests
```
$ bash tests/dotenv-test.sh
Testing blank line parsing: ok
Testing unquoted: ok
Testing single quoted: ok
Testing double quoted: ok
Testing interpolation: ok
Testing preservation of existing variables: ok
Testing parsing of last line: ok
Test loading variables from default.env file: ok
Test .env variables override variables from default.env file: ok
$
```