1.15.2 • Published 1 year ago

@tuplo/envsubst v1.15.2

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

envsubst

Substitutes the values of environment variables. Based on GNU envsubst.

Usage

import envsubst from '@tuplo/envsubst';

Substitutes the values of environment variables

process.env = { ENV_VAR1: 'bar' };

envsubst('foo=$ENV_VAR1'); // → foo=bar

envsubst('foo=${ENV_VAR1}'); // → foo=bar

envsubst('foo={{ENV_VAR1}}'); // → foo=bar

If shellFormat is present, replaces only those variables

process.env = { ENV_VAR1: 'bar', ENV_VAR2: 'baz' };

envsubst('$ENV_VAR1 $ENV_VAR2', '$ENV_VAR2'); // → $ENV_VAR1 baz

API

envsubst(input, shellFormat)

input: string

A string with references to environment variables of the form $VARIABLE, ${VARIABLE} or {{VARIABLE}}.

shellFormat: string

The output consists of the environment variables that are referenced in shellFormat.

Install

$ npm install @tuplo/envsubst

# or with yarn
$ yarn add @tuplo/envsubst

Contribute

Contributions are always welcome!

License

MIT

1.15.2

1 year ago

1.15.1

1 year ago

1.15.0

2 years ago

1.14.0

2 years ago

1.13.0

3 years ago

1.12.0

3 years ago

1.9.0

3 years ago

1.11.0

3 years ago

1.10.0

3 years ago

1.8.0

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago