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 createssecrets.yaml
andcustom-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.
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
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]
-
-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
-
-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.