Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handlebars template previewer #1137

Closed
mivok opened this issue Aug 9, 2016 · 3 comments
Closed

Handlebars template previewer #1137

mivok opened this issue Aug 9, 2016 · 3 comments
Labels
Type: Feature Issues that describe a new desired feature
Milestone

Comments

@mivok
Copy link
Contributor

mivok commented Aug 9, 2016

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.

@mivok
Copy link
Contributor Author

mivok commented Aug 9, 2016

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.

@reset reset added the Backlog label Aug 16, 2016
@bdangit
Copy link
Contributor

bdangit commented Sep 19, 2016

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 😁

@baumanj
Copy link
Contributor

baumanj commented Jun 14, 2019

Does #6114 suffice? It not, please re-open.

@baumanj baumanj closed this as completed Jun 14, 2019
@christophermaier christophermaier added Type: Feature Issues that describe a new desired feature and removed C-feature labels Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Issues that describe a new desired feature
Projects
None yet
Development

No branches or pull requests

8 participants