@dsolodky/yaml-envsubst
v1.1.3
Published
envsubst tool for yaml files (especially for kubernetes yaml files)
Downloads
12
Maintainers
Readme
yaml-envsubst
envsubst tool for yaml files (especially for kubernetes yaml files)
This tool is created in order to substitute envrionment varibales inside the Kubernetes yaml templates during the Gitlab CI job execution.
You can have two variants:
- Substitute values or part of values.
test: ${MYVAR}
test2: ${MYVAR}-some text
test3: ${MULTILINE_VAR}
in case if you set your environment like that:
export MYVAR=First value
export MULTILINE_VAR="First line
second line"
You will get this yaml as an output:
test: First value
test2: First value-some text
test3: |-
First line
second line
- Substitute complete key:
${test}:
innerKey: value
anotherKey: value
so you can define the env variables test as:
key1:
otherKey: value
otherKey2: value
as aa result you will get:
key1:
otherKey: value
otherKey2: value
innerKey: value
anotherKey: value
A variable value may contain another variable, which is also supported.
Installation
npm install -g @dsolodky/yaml-envsubst
You will probably want to add it to you docker file.
RUN apk add --update npm
RUN npm install -g @dsolodky/yaml-envsubst
Usage
The tool expects two command line arguments
yaml-envsubst ./kubernetes-template.yaml ./kubernetes.yaml