Webhook: Allow Webhook Configuration File To Resolve Values From Environment Variables

Created on 23 Oct 2018  路  4Comments  路  Source: adnanh/webhook

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.

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 -template switch when starting webhook.
:-)

All 4 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zoenglinghou picture zoenglinghou  路  4Comments

AndrewSav picture AndrewSav  路  6Comments

adamaze picture adamaze  路  5Comments

nkv16786 picture nkv16786  路  3Comments

MichelDiz picture MichelDiz  路  5Comments