Skip to content

Convert script to load config from envvars #6

patcon opened this Issue Apr 22, 2014 · 4 comments

3 participants

patcon commented Apr 22, 2014

Would it be possible to move wholesale to using envvars for config? My understanding is that this is a good practice for heroku and for any 12-factor apps.

jakeyr commented Nov 24, 2015

One hack I did here was to create a file pagerdutyrc.tpl with environment variables in it like ${TOKEN}, then create a script called that looked like this:

perl -p -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : $&/eg; s/\$\{([^}]+)\}//eg'

and add the following to my packages.json:

  "scripts": {
    "postinstall": "cat pagerdutyrc.tpl | ./ > pagerdutyrc"

This will insert all the variables from your heroku config into the template during deploy. They'll still be packaged in the slug but at least you don't have to check them in.

patcon commented Nov 24, 2015

fyi i think the github one is the active hubot script for pageduty now :)

jakeyr commented Nov 24, 2015

Indeed, but this one shows all schedules instead of just one and was easy to set up.

erikh commented Nov 24, 2015

I'm not opposed to it, but it would have to come from an outside contributor. I don't have a lot of cycles to maintain it anymore and moved back into full-time development, so I no longer have a need for it.

If someone wants to maintain it full-time I can help facilitate that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.