Ember Patch Config
Patch Ember CLI 2.x app configuration at runtime.
What is it for?
Well, sometimes you just want to change ember's config (app/config/environment.js
) before everything is loaded, or even extract it programmatically from Local Storage or a Cookie.
Ok, how?
First you need to import EmberApp
from a different location:
// ember-cli-build.js const EmberApp = ; module { const app = defaults // ... }
Then, add an inline script in app/index.html
(before the app & vendor scripts):
<!-- app/index.html -->{{content-for 'rev-header'}} <!-- ... --> <!-- ... --> <!-- ... -->
The content of window.configToPatch
will be DEEPLY MERGED into the module <your-app-name>/config/environment.js
at runtime, before the app is initialized (even before initializers).
Options
Options can be passed within the ember-patch-config
node of EmberApp
options object.
globalVarName
Type: String
Default: 'configToPatch'
The global variable name to patch the config from.