Add JSON5 support, --json CLI flag, typed getters, and improve YAML quoting
- Updated JSON resolver to use gjson library for JSON5 support (comments, trailing commas) - Added --json flag to CLI tool for JSON output format - Added typed getter methods: GetInt(), GetUint(), GetFloat(), GetBool(), GetBytes() - GetBytes() supports human-readable formats like "10G", "20KiB" via go-humanize - Fixed YAML interpolation to always quote output values for safety - Updated README to clarify YAML-only input and automatic quoting behavior - Added .gitignore to exclude compiled binary - Fixed test config files to use unquoted interpolation syntax - Updated tests to expect quoted interpolation output
This commit is contained in:
@@ -6,20 +6,20 @@ server:
|
||||
hostname: ${EXEC:hostname}
|
||||
|
||||
machine:
|
||||
id: "${FILE:./test/machine-id}"
|
||||
cores: "${EXEC:echo 4}"
|
||||
id: ${FILE:./test/machine-id}
|
||||
cores: ${EXEC:echo 4}
|
||||
|
||||
api:
|
||||
endpoint: "${JSON:./test/hosts.json:'.api_endpoints.primary'}"
|
||||
tls_host: "${JSON:./test/hosts.json:'.tls_sni_host[0]'}"
|
||||
endpoint: ${JSON:./test/hosts.json:api_endpoints.primary}
|
||||
tls_host: ${JSON:./test/hosts.json:tls_sni_host.0}
|
||||
|
||||
database:
|
||||
host: "${YAML:./test/data.yaml:'.database.host'}"
|
||||
version: "${YAML:./test/data.yaml:'.version'}"
|
||||
host: ${YAML:./test/data.yaml:'.database.host'}
|
||||
version: ${YAML:./test/data.yaml:'.version'}
|
||||
|
||||
nested:
|
||||
value: "${ENV:NESTED_${ENV:TEST_ENV_SUFFIX}}"
|
||||
value: ${ENV:NESTED_${ENV:TEST_ENV_SUFFIX}}
|
||||
|
||||
env:
|
||||
INJECTED_VAR: "injected-value"
|
||||
COMPUTED_VAR: "${EXEC:echo computed}"
|
||||
COMPUTED_VAR: ${EXEC:echo computed}
|
||||
Reference in New Issue
Block a user