Skip to content

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 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

2 participants