Staging to Production without Rebuild


I am currently using ember-cli to build my production package and I am able to pass in the URI for which API to connect to at build time (staging or production … and respectively). But this requires me to rerun ember build --environment=production to set to the API.

Is there a good way? or does anyone have any suggestions as to how to let my app discover the API at load time? Perhaps put something in index.html after the build, so I can just tweak that setting.

Basically, I want to build with environment=production, and then be able to deploy it twice without rebuilding, but still have each deploy point to a different API URI.


Did you ever come up with a solution for this?


I did not, but I’m no longer working with that project. The idea I had been given to try though was to put some indicator/flag in the index.html and have all routes available in the app itself… rather than only build in 1 at a time.


If you build index.html as a template which is then re-processed before deploying it is easy enough to add environment-specific variables; if you have your environment variables set to build into index.html instead of your app.js file, and set, say,

ENV.APIHOST = '@ApiHost@';

(where @ApiHost@ is a template string) for your staging/prod builds, then you can just replace that value before deploying. If it’s in the environment settings tag the output needs to be urlencoded, and you’d need to use a template string that won’t itself be encoded by ember-cli to keep it simple.