dotenv-transformer

3.2.1 • Public • Published

dotenv-transformer

Build Status npm version Coverage Status

Description

The dotenv-transformer is a command-line interface for transforming .env files for different needs, mostly used in devops pipelines. It has coommands:

  • gen - will read environment variables from .env.deploy and creates secrets.yaml and custom-env.yaml files. If you provide a KeyVault name, it will check if the secrets exist in it.

  • extract - will read .env.deploy and some specific .env.<env> filled with overrides and produce final .env.build that can be used in the build process - specificaly passing them to docker build task as --build-arg parameters.

Installation

No installation needed - using npx :

npx dotenv-transformer gen -e <environment name> -df <path to the .env.??? files> -s <service name> -d <destination path> -kv <Key Vault> [-skv]

or you can install it globaly using npm:

npm install dotenv-transformer -g

Usage

if not installed:

npx dotenv-transformer gen -e <environment name> -df <path to the .env.?? files> -s <service name> -d <destination path> -kv <Key Vault> [--skipKV]

else:

dotenv-transformer gen -e <environment name> -df <path to the .env.?? files> -s <service name> -d <destination path> -kv <Key Vault> [--skipKV]

Commands & Options

Command gen

options
  • -e, --env <environment name>: The name of the environment we are deploying to (required)
  • -df, --dotenvFolder <path to the .env.?? files>: Path to the folder containing .env.deploy file and/or .env. specific files (required)
  • -s, --service <service name>: The name of the service (required)
  • -d, --destinationPath <destination path>: Full folder name to save the yaml files (required)
  • -kv, --keyvault <Key Vault>: Key Vault Name needed for secret.yaml and to check if the secrets exist in it
  • -skv, --skipKV: (optional) If you want to skip checking for secrets existance in the Key Vault

Command extract

options
  • -e, --env <environment name>: The name of the environment we are deploying to (required)
  • -df, --dotenvFolder <path to the .env.?? files>: Path to the folder containing .env.deploy file and/or .env. specific files (required)
  • -o, --outputFile <file name with path>: file name with path to save the interpolated environment variables - defalut: .env.build in current folder
  • -kv, --keyvault <Key Vault>: (optional) Key Vault Name - if provided the tool will get the secret values from it.

Package Sidebar

Install

npm i dotenv-transformer

Weekly Downloads

25

Version

3.2.1

License

MIT

Unpacked Size

18.4 kB

Total Files

12

Last publish

Collaborators

  • niktv