I have an EmberCLI app where Staging and Prod both live on the same S3 bucket, and in config/environment.js the environment variable is the same. Still I need to be able to specify different settings for the two "environments".
The surefire way to tell which app is running is by inspecting the domain of the request, but I'm having trouble intercepting that early enough to update my settings.
I've tried creating an initializer to inspect the domain and update the ENV object accordingly, but it seems it's too late in the page lifecycle to have any effect; the page has already been rendered, and my addons do not see their proper settings.
For one addon, I basically had to copy all of its code into my project and then edit the index.js file to use the proper keys based on my domain, but it's unwieldy. Is there a better way to do this? Am I trying to make an architecture work which is just ill-advised?
Any advice from those more versed in Ember would be much appreciated.
There's not a great way to handle staging environments right now (see Stefan Penner's comment here).
That said I think you can achieve a staging environment on s3 by using
ember-cli-deploy
if you add a staging environment to your ember-cli-deploy config. And handle the difference between staging and production inember-cli-build.js
.