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

add json template function to allow escaping of environment variables #21

Merged

Conversation

achille-roussel
Copy link
Contributor

Fixes #20

The idea here is to allow escaping of environment variables into JSON values (which are compatible with YAML).

Please take a look and let me know if something should be changed.

@@ -338,6 +338,30 @@ points:
}
}

func TestTemplateFunc(t *testing.T) {
const configFile = "/tmp/conf-json-test.yml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to change this, but neat func to make it more portable:

https://golang.org/pkg/io/ioutil/#TempFile

@abraithwaite
Copy link
Contributor

This is neat! 👍

Very clean way to handle these cases universally. Should we add a null test in there too or do we expect that to still not be supported?

@achille-roussel
Copy link
Contributor Author

I’m gonna take care of the null issue in a different PR.

@achille-roussel achille-roussel merged commit ee865b9 into master Dec 10, 2017
@achille-roussel achille-roussel deleted the allow-special-characters-in-template-variables branch December 10, 2017 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants