External config file, how?


#1

How can I tell my Ember app to require/import an external file with config settings?

To be clear, I want my post-build app to look for a simple config file and - if it exists - import it and overwrite the default settings. The end goal here would be to have multiple instances of one app running in several places, with different settings that I can change on the fly.

Thanks in advance!

Kevin

PS Ideally, the config file would have structure like:

module.exports = { ‘settingName’ : ‘val’ };

so, no Ember specific code.


#3

I think you’re after something like this plugin: https://github.com/ember-cli-deploy/ember-cli-deploy-json-config/blob/master/README.md

Ember-CLI defaults to generating a meta tag, but you can also store the config in a JSON blob (don’t have a link at hand at the moment). That should be enough to get you pointed in the right direction though …