Closed blalor closed 9 years ago
Yeah, this is a great idea. It should probably be a 'per environment' type of a build variable.
I was actually thinking it should be run-time config. That way you can package up the dist
dir and change the config afterwards, without having to re-run ember build
.
Ah, I see. That makes sense. Do you have an idea of how/where to do that?
No, I'm afraid not. Ember's pure voodoo to me. This model is used by applications like Grafana and Kibana, however; not sure if that'll be of use…
Would it work to use environment variables?
I don't know ember well enough to know how to do it, but in node world something like this would work.
As part of the canary-ember
startup process do something like this...
export CANARY_EMBER_API_HOST="http://mycanaryapi/"
export CANARY_EMBER_CHECK_HOST="http://mycanarychecks/"
Then in application.js
do something like
host : process.env.CANARY_EMBER_CHECK_HOST || 'https://s3.amazonaws.com/'
And in measurement.js
do something like
host : process.env.CANARY_EMBER_API_HOST || 'https://api.canary.io/'
That only works if Node is evaluating the JS. The output of the build process is a static set of HTML, CSS and JS files. They can be served by Apache or Nginx. The environment would have no effect on those static files. Instead, the application should read its config from a file that the browser can retrieve and interpret.
Thanks for clarifying that @blalor. I'll learn how this Ember stuff works eventually.
So, you'd like a config file that should be read at initial load, if present, and used to set run-time values for the canary api and checks hosts?
Would hand-crafted JSON be OK? Maybe something like this proposed canary-hosts.json
:
{
"api": "http://mycanaryapi/",
"checks": "http://mycanarychecks/"
}
Yep, that’s exactly correct, Rick. Hand-crafted JSON is perfect; it’ll be created via Chef, most likely. :-)
With the main canary project being in transition and the JSON endpoint no longer running I'm just going to close this. Thanks to everyone who pitched in on this project!
<3
It'd be great if I could just specify the base URL for the Canary API and the location of the JSON file containing check definitions in a config file. Right now I have to hack application.js and measurements.js (?) when I want to use a private instance of Canary.