-
Notifications
You must be signed in to change notification settings - Fork 424
Config Vars #21
Config Vars #21
Conversation
@mattcreager @ojacobson any other thoughts on this? |
Love the idea and don't see any issues with implementation at a glance. |
@hone without this feature, I'm going to be forced to setup a seperate API to serve env specific configuration. |
This is an awesome idea. |
@mattcreager can you explain your use case a bit more? I can rebase this PR against master for the time being. |
I'm actually doing something a lot like this in one of my own apps (which uses Node, rather than this buildpack): have a look and here. The underlying motivation for me is almost exactly what it would be in a server-side app: to provide per-deployment values such as tokens, and to bind external resources (the API service, in this case) to the deployment. |
👍 Any plans to pull this soon-ish? |
This seems like a great idea to me—merge soon? |
In the meantime, is there any way to access env variables at build time ? |
Hi! This buildpack is now deprecated and we are recommending people move the more actively maintained heroku-buildpack-nginx. For migration advice see here. As such, I'm closing this PR out since we won't be making further changes to this buildpack. |
The buildpack will read any env vars that are prefixed with
HEROKU_STATIC_
and write out a file accessible at/--/env.js
and/--/env.json
. The/--/env.js
file will create a JavaScript object__env
onwindow
. Where the/--/env.json
will just be a JSON representation.An example how this will look:
If the env vars are set,
FOO
will be picked up butBAR
will not be./--/env.js
:/--/env.json
: