mirror of
https://github.com/mikefarah/yq.git
synced 2026-03-10 15:54:26 +00:00
v4.49.1
This commit is contained in:
parent
451724d514
commit
06517a463e
@ -29,6 +29,9 @@ as follows:
|
|||||||
yq '(.. | select(tag == "!!str")) |= envsubst' file.yaml
|
yq '(.. | select(tag == "!!str")) |= envsubst' file.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Disabling env operators
|
||||||
|
If required, you can use the `--security-disable-env-ops` to disable env operations.
|
||||||
|
|
||||||
|
|
||||||
## Read string environment variable
|
## Read string environment variable
|
||||||
Running
|
Running
|
||||||
@ -254,3 +257,39 @@ will output
|
|||||||
Error: variable ${notThere} not set
|
Error: variable ${notThere} not set
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## env() operation fails when security is enabled
|
||||||
|
Use `--security-disable-env-ops` to disable env operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'env("MYENV")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: env operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## strenv() operation fails when security is enabled
|
||||||
|
Use `--security-disable-env-ops` to disable env operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'strenv("MYENV")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: env operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## envsubst() operation fails when security is enabled
|
||||||
|
Use `--security-disable-env-ops` to disable env operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input '"value: ${MYENV}" | envsubst'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: env operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,10 @@ this.is = a properties file
|
|||||||
bXkgc2VjcmV0IGNoaWxsaSByZWNpcGUgaXMuLi4u
|
bXkgc2VjcmV0IGNoaWxsaSByZWNpcGUgaXMuLi4u
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Disabling file operators
|
||||||
|
If required, you can use the `--security-disable-file-ops` to disable file operations.
|
||||||
|
|
||||||
|
|
||||||
## Simple example
|
## Simple example
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@ -194,3 +198,63 @@ cool: things
|
|||||||
more_stuff: my secret chilli recipe is....
|
more_stuff: my secret chilli recipe is....
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## load() operation fails when security is enabled
|
||||||
|
Use `--security-disable-file-ops` to disable file operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'load("../../examples/thing.yml")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: file operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## load_str() operation fails when security is enabled
|
||||||
|
Use `--security-disable-file-ops` to disable file operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'load_str("../../examples/thing.yml")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: file operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## load_xml() operation fails when security is enabled
|
||||||
|
Use `--security-disable-file-ops` to disable file operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'load_xml("../../examples/small.xml")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: file operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## load_props() operation fails when security is enabled
|
||||||
|
Use `--security-disable-file-ops` to disable file operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'load_props("../../examples/small.properties")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: file operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## load_base64() operation fails when security is enabled
|
||||||
|
Use `--security-disable-file-ops` to disable file operations for security.
|
||||||
|
|
||||||
|
Running
|
||||||
|
```bash
|
||||||
|
yq --null-input 'load_base64("../../examples/base64.txt")'
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```bash
|
||||||
|
Error: file operations have been disabled
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@ -104,6 +104,27 @@ owner:
|
|||||||
suburb: nice
|
suburb: nice
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Parse: Array of Array Table
|
||||||
|
Given a sample.toml file of:
|
||||||
|
```toml
|
||||||
|
|
||||||
|
[[fruits]]
|
||||||
|
name = "apple"
|
||||||
|
[[fruits.varieties]] # nested array of tables
|
||||||
|
name = "red delicious"
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq -oy '.' sample.toml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```yaml
|
||||||
|
fruits:
|
||||||
|
- name: apple
|
||||||
|
varieties:
|
||||||
|
- name: red delicious
|
||||||
|
```
|
||||||
|
|
||||||
## Parse: Empty Table
|
## Parse: Empty Table
|
||||||
Given a sample.toml file of:
|
Given a sample.toml file of:
|
||||||
```toml
|
```toml
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user