topcoderinc / dsp-frontend

React fronted to drone series
8 stars 23 forks source link

On Heroku, ENV vars aren't honored. #12

Closed mtwomey closed 7 years ago

mtwomey commented 7 years ago

We're on Heroku now - awesome! Frontend config variables can't be overridden by Heroku env settings right now though. They are falling through to their backup values:

API_BASE_PATH: process.env.API_BASE_PATH || 'https://kb-dsp-server-dev.herokuapp.com'

This falls through to 'https://kb-dsp-server-dev.herokuapp.com' regardless of what you have set API_BASE_PATH to in Heroku. Maybe this has to do with webpack?

mtwomey commented 7 years ago

Or maybe it's looking at my browser side env?

gondzo commented 7 years ago

The variables need to be set before the build. Only those defined in webpack.config.js#100 (DefinePlugin) will be filled out. Also, we have 2 config files one in config/*.js and this one is read by the server app hosting process, and the second one is in src/config.index.js I'll push a fix for this later.