This repository was archived by the owner on May 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on May 22, 2025. It is now read-only.
Make variables subscriptable #6
Copy link
Copy link
Open
Description
Since StrictYAML parses all literals as strings, variables fit into configuration files seamlessly without having to quote them:
number: 400
line: some string
variable: ${pullconf::some-variable}Right now variables need to resolve to the same type that is expected from the parameter where the variable is found or resolve to a string if substring substitution is used inside another string parameter:
variables:
ip: 192.168.0.200
mode: 0600
resources:
- type: host
parameters:
ip_address: ${pullconf::ip}
hostname: ${pullconf::hostname}
aliases:
- me
- myself
- I
- type: file
parameters:
path: /etc/ssh/sshd_config
content: |
...
Listen ${pullconf::ip}
...It would be useful if variables were subscriptable in a way so values inside hash and array variables can be accessed:
variables:
sshd:
port: 22
ip: 192.168.0.200
- type: file
parameters:
path: /etc/ssh/sshd_config
mode: ${pullconf::mode}
content: |
...
Listen ${pullconf::sshd.ip}
Port ${pullconf::sshd.port}
...The syntax for accessing values inside hashes and arrays could be:
- dots for accessing keys inside hashes
- numbers inside square brackets to access array elements
Making variables subscriptable allows users to organize their variables better.
Possible issues: Variables should still be able to contain other variables. Resolving variables thus becomes a little more complex.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels