Updating docs

This commit is contained in:
Mike Farah
2022-01-28 10:06:25 +11:00
parent 6f27cb93d1
commit a6fc7aa881
57 changed files with 389 additions and 370 deletions
@@ -13,14 +13,14 @@ To replace environment variables across all values in a document, `envsubst` can
as follows:
```bash
yq eval '(.. | select(tag == "!!str")) |= envsubst' file.yaml
yq '(.. | select(tag == "!!str")) |= envsubst' file.yaml
```
## Read string environment variable
Running
```bash
myenv="cat meow" yq eval --null-input '.a = env(myenv)'
myenv="cat meow" yq --null-input '.a = env(myenv)'
```
will output
```yaml
@@ -30,7 +30,7 @@ a: cat meow
## Read boolean environment variable
Running
```bash
myenv="true" yq eval --null-input '.a = env(myenv)'
myenv="true" yq --null-input '.a = env(myenv)'
```
will output
```yaml
@@ -40,7 +40,7 @@ a: true
## Read numeric environment variable
Running
```bash
myenv="12" yq eval --null-input '.a = env(myenv)'
myenv="12" yq --null-input '.a = env(myenv)'
```
will output
```yaml
@@ -50,7 +50,7 @@ a: 12
## Read yaml environment variable
Running
```bash
myenv="{b: fish}" yq eval --null-input '.a = env(myenv)'
myenv="{b: fish}" yq --null-input '.a = env(myenv)'
```
will output
```yaml
@@ -60,7 +60,7 @@ a: {b: fish}
## Read boolean environment variable as a string
Running
```bash
myenv="true" yq eval --null-input '.a = strenv(myenv)'
myenv="true" yq --null-input '.a = strenv(myenv)'
```
will output
```yaml
@@ -70,7 +70,7 @@ a: "true"
## Read numeric environment variable as a string
Running
```bash
myenv="12" yq eval --null-input '.a = strenv(myenv)'
myenv="12" yq --null-input '.a = strenv(myenv)'
```
will output
```yaml
@@ -85,7 +85,7 @@ dog: woof
```
then
```bash
myenv="cat" yq eval '.[env(myenv)]' sample.yml
myenv="cat" yq '.[env(myenv)]' sample.yml
```
will output
```yaml
@@ -95,7 +95,7 @@ meow
## Replace strings with envsubst
Running
```bash
myenv="cat" yq eval --null-input '"the ${myenv} meows" | envsubst'
myenv="cat" yq --null-input '"the ${myenv} meows" | envsubst'
```
will output
```yaml
@@ -105,7 +105,7 @@ the cat meows
## Replace strings with envsubst, missing variables
Running
```bash
myenv="cat" yq eval --null-input '"the ${myenvnonexisting} meows" | envsubst'
myenv="cat" yq --null-input '"the ${myenvnonexisting} meows" | envsubst'
```
will output
```yaml
@@ -115,7 +115,7 @@ the meows
## Replace strings with envsubst, missing variables with defaults
Running
```bash
myenv="cat" yq eval --null-input '"the ${myenvnonexisting-dog} meows" | envsubst'
myenv="cat" yq --null-input '"the ${myenvnonexisting-dog} meows" | envsubst'
```
will output
```yaml
@@ -129,7 +129,7 @@ v: ${myenv}
```
then
```bash
myenv="cat meow" yq eval '.v |= envsubst' sample.yml
myenv="cat meow" yq '.v |= envsubst' sample.yml
```
will output
```yaml