YAML Export Templates
Opened this issue · 2 comments
Our legacy YAML files include inline documentation, e.g.
client:
# The client name is:
# - exposed to the algorithm/process engine through the ENV directive for selecting configurations
# - used to set Django's sites value
# - used to configure the Mirth server name
name: demo
# Release determines which "tags" may be uploaded to the machine. Accepted values are `dev`, `alpha`, `beta`, and
# `production`. For example, a production system will not accept a tag like `1.x.x-dev`.
release: beta
When extracting configurations from SSM, it'd be great to be able to preserve/leverage similar documentation. I'm not sure if any of the YAML parsers can preserve comments, but it would be nice if I could select a YAML file as a "template" and have it overwrite (or append) key-value pairs, preserving whatever documentation already exist.
Obviously, this would need to be combined with path-specific exports or adding new clients/services would be a mess. There would definitely be some edge cases (e.g. whether to repeat templates in lists), but it'd be useful to address the simplest/most general case and refine as-needed.
Obviously, this request would not work as well with the -p
behavior (if that even works on init). You'd need to be able to select a specific path (e.g. /service/<service>/dev
or /service/<service>/prod
or the template would need to include sections for dev
and prod
containing all of the same text.
Did some digging. Per this SO answer, PyYAML discards comments when parsing. There are several other projects (some likely drop-in replacements) that could be used to support this.