🚀 Socket Launch Week 🚀 Day 2: Introducing Repository Labels and Security Policies.Learn More
Socket
Sign inDemoInstall
Socket

@tuplo/envsubst

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuplo/envsubst

Substitutes environment variables in strings

1.15.2
latest
Source
npm
Version published
Weekly downloads
620
-47.55%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

envsubst

FAQs

Package last updated on 08 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts