1.15.2 • Published 2 years ago

@tuplo/envsubst v1.15.2

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.15.1

2 years ago

1.15.0

3 years ago

1.14.0

3 years ago

1.13.0

4 years ago

1.12.0

4 years ago

1.9.0

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago