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

Allow hooks file to be parsed as a template #161

Merged
merged 1 commit into from Nov 9, 2017

Conversation

moorereason
Copy link
Collaborator

Add a -template command line option that instructs webhook to parse the hooks files as Go text templates.

This is a quick proof-of-concept. Needs tests. I may not be able to work on this for several days, but I wanted to push it out to see what others think about this approach.

Updates #160

@moorereason moorereason changed the title WIP: Allow hooks file to be parsed as a template Allow hooks file to be parsed as a template Sep 26, 2017
@adnanh
Copy link
Owner

adnanh commented Nov 4, 2017

Any updates on the state? :)

Add a -template command line option that instructs webhook to parse the
hooks files as Go text templates.

Includes a `getenv` template func for retrieving environment variables.
@moorereason
Copy link
Collaborator Author

I think this is ready for review and merging. It's fairly straight-forward. Let me know if you have any questions.

@adnanh
Copy link
Owner

adnanh commented Nov 9, 2017

This looks awesome! Could you please update the wiki parameters (and perhaps create a separate page showing a simple use case how to use this. also don't forget to link to https://golang.org/pkg/text/template/ for those who would like to try more esoteric stuff with templates)

@adnanh adnanh merged commit 01aa178 into adnanh:development Nov 9, 2017
@moorereason
Copy link
Collaborator Author

I updated the Webhook Parameters page just now.

Instead of creating a new wiki page, would it make more sense to add a short section about templates to the Readme?

@adnanh
Copy link
Owner

adnanh commented Nov 9, 2017

Maybe we should go with the different approach. The wiki approach is a little bit flawed, as in, it is strongly related to the the latest release. How about we add docs/ folder with the markdown file(s?) containing the current wiki contents. That way we can also have versioned documentation.

How does that sound? Maybe you have a better approach to all of this?

@moorereason
Copy link
Collaborator Author

Sounds good. 👍

@adnanh
Copy link
Owner

adnanh commented Nov 9, 2017

Of course this should be a separate issue from this topic :-) Thanks for this contribution and making webhook even more awesome!

@moorereason moorereason deleted the templates branch October 19, 2019 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants