It would be ideal if after parsing the configuration file, environment variables can be resolved. Something like the following:
[
{
"id": "redeploy-webhook",
"execute-command": "/home/adnan/redeploy-go-webhook.sh",
"command-working-directory": "/home/adnan/go",
"response-message": "Executing redeploy script",
"trigger-rule":
{
"match":
{
"type": "value",
"value": "${ENV_SLACK_TOKEN}",
"parameter":
{
"source": "payload",
"name": "token"
}
}
}
}
]
Some scala projects such as pureconfig already do that.
what I do is prior to launching just copy config file to elsewhere then issue this in a bash launcher script
sed -i -- "s|ENV_SLACK_TOKEN|${ENV_SLACK_TOKEN}|g" $curr_file
to translate the value of env var into that string ENV_SLACK_TOKEN found in config file
Hi, please take a look at https://github.com/adnanh/webhook/blob/master/docs/Templates.md
P.S. don't forget to add the -template switch when starting webhook.
:-)
@adnanh Sorry, I should have researched it better 馃槥
@scottstensland Thanks for your answer, I think I am going to move with the OOTS seems like a _cleaner_ approach; I think you should do the same 馃槈...
@eschizoid good luck :-)
Most helpful comment
Hi, please take a look at https://github.com/adnanh/webhook/blob/master/docs/Templates.md
P.S. don't forget to add the
-templateswitch when starting webhook.:-)