tgittos / interpolator

Add environment interpolation to any YAML, JSON or TOML config file

Repository from Github https://github.comtgittos/interpolatorRepository from Github https://github.comtgittos/interpolator

interpolator

Add environment interpolation to any YAML, JSON or TOML config file in any Linux, Mac, Windows, FreeBSD, OpenBSD, NetBSD, BIOS based system leveraging Cosmopolitan.

Usage

interpolator is designed to replace all matched values with those defined in the environment. If a match in the environment is not found, no substitution will occur.

The interpolation tag for interpolator is ${SOME_ENV_VAR}.

You can use interpolator to interpolate using stdin:

cat config.yaml | ./interpolate > interpolated_config.yaml

or you can use it to interpolate files:

./interpolate config.yaml interpolated_config.yaml

use inline environment variables:

SOME_ENV_VAR=foo cat config.yaml | ./interpolate > interpolated_config.yaml

Motivation

A simple cross platform way to wholesale interpolate environment variables in config files for software that doesn't support it natively.

About

Add environment interpolation to any YAML, JSON or TOML config file

License:MIT License


Languages

Language:C 73.8%Language:Dockerfile 24.2%Language:Shell 2.1%