dotenvsubst

Crates.iodotenvsubst
lib.rsdotenvsubst
version0.1.4
sourcesrc
created_at2020-05-04 10:22:53.877996
updated_at2020-05-11 06:40:19.125739
descriptionA cli tool to search and replace environment variables from .env files
homepage
repositoryhttps://github.com/gmlion/dotenvsubst
max_upload_size
id237355
size50,904
(gmlion)

documentation

README

Rust

dotenvsubst

dotenvsubst is a little command line utility to substitute environment variables

HOW TO INSTALL

cargo install dotenvsubst. You need to have Cargo installed.

SYNOPSIS

dotenvsubst [ENVFILE]

DESCRIPTION

Standard input is copied to standard output, with reference to environment variables of the form ${VARIABLE} being replaced with corresponding values read from the specified ENVFILE. If no ENVFILE is specified, the program looks for a .env file in the current directory. If the environment variable is not found, the text is kept intact. The syntax for the ENVFILE is composed of variables on new lines in the form of NAME=VALUE.

EXAMPLES

Using a custom .env_custom ENVFILE on bash: cat file.sh | dotenvsubst .env_custom > file_env_custom.sh

Using default .env file in Powershell: Get-Content file.sh | dotenvsubst > file_env.sh

As an example of a specific use case, you can create specific Dockerfiles from a template and .env files
cat Dockerfile.template | dotenvsubst .env.development > Dockerfile.development
cat Dockerfile.template | dotenvsubst .env.production > Dockerfile.production

Commit count: 26

cargo fmt