You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating configuration file templates while writing plans, it would be nice to be able to run a quick check to verify that the syntax of your template is valid and that it does what you want given some sample data without having to rebuild the template every time.
An example of the sort of thing I'd like to be able to see:
# Setup commands to create sample files
$ echo -e '[foo]\nbar=baz' > test_data.toml
$ echo -e '{{cfg.foo.bar}}' > config/sample.conf
# The proposed command itself
$ hab template config/sample.conf test_data.toml
baz
# This would also work with default.toml
$ hab template config/sample.conf default.toml
some_other_value
For dynamic variables such as svc.leader, I would like sensible placeholder values to be given by default, and allow you to override them with custom toml or perhaps command line options. This might require an optional third argument for the custom toml as the test_data.toml/default.toml files need to be loaded under the cfg namespace.
The text was updated successfully, but these errors were encountered:
I made a really simple version of this (right now it just loads the toml directly into cfg and ignores other variable) here: https://github.com/mivok/hab_template_preview. The libraries in util are taken directly from hab-sup.
This would really be useful especially as its really painful to keep recompiling the binary in order to test configs. I would imagine as we mature, there would be a test folder or a spec folder where we can unit test our Hab plan.sh and any config handlebar templates. Perhaps there would be HabSpec 😁
When creating configuration file templates while writing plans, it would be nice to be able to run a quick check to verify that the syntax of your template is valid and that it does what you want given some sample data without having to rebuild the template every time.
An example of the sort of thing I'd like to be able to see:
For dynamic variables such as svc.leader, I would like sensible placeholder values to be given by default, and allow you to override them with custom toml or perhaps command line options. This might require an optional third argument for the custom toml as the test_data.toml/default.toml files need to be loaded under the cfg namespace.
The text was updated successfully, but these errors were encountered: