A tool for injecting specific environment variables into a stream of data
Go to file
Rob Watson 4e48824fc0
continuous-integration/drone/push Build is passing Details
docs: update README.md
2023-09-12 21:25:29 +02:00
scanner Add first iteration and test suite 2022-05-16 02:51:18 +02:00
.drone.yml chore: upgrade to Go 1.21 2023-09-12 21:04:53 +02:00
LICENSE docs: update README.md 2023-09-12 21:25:29 +02:00
README.md docs: update README.md 2023-09-12 21:25:29 +02:00
go.mod chore: upgrade to Go 1.21 2023-09-12 21:04:53 +02:00
go.sum chore: upgrade to Go 1.21 2023-09-12 21:04:53 +02:00
main.go Add first iteration and test suite 2022-05-16 02:51:18 +02:00

README.md

envfilesubst

envfilesubst is a variation of gettext's envsubst, with a different modus operandi.

Firstly, instead of reading the current environment it reads from file in traditional "envfile" format.

Secondly, it will read input from stdin replacing all variable references that can be matched with the envfile. If variables are not explicitly mentioned in the envfile, the references will be left untouched (instead of replacing them with an empty string).

Git

The main git repo is: https://git.netflux.io/rob/envfilesubst

It is also mirrored on GitHub: https://github.com/rfwatson/envfilesubst

Installation

go install git.netflux.io/rob/envfilesubst@latest

Usage

Given an envfile:

# myenvfile
FOO=bar
X=1

Then:

echo "FOO is $FOO and X is ${X}. I don't know $BAZ." | envfilesubst -f myenvfile

The output is:

FOO is bar and X is 1. I don't know $BAZ.