How to provide dynamic configuration

Okay, so I feel a bit lost here. I’m pretty sure for what I want to achieve I need a service and / or an initializer, but I’ll explain the problem first.

In our web app, there are various layout specific settings. They have nothing to do with the actual data that is displayed, but rather how it is displayed. Like a sorting preference for tables or a banner on the homepage that is updated frequently and thus is independent of the actual design / code.

I can’t send those variables in the index.html as they can change over the course of using the app (e.g. sorting preferences). I can’t save them in a ember-simple-auth session, as they need to be synchronized across browsers and most of them aren’t really user specific, or more precisely they are used for layout stuff (e.g. image or other media URLs).

Notice that I’m not speaking about real content here. Those images and media files don’t change in dependence of a dynamic segment. They are a static part of the app’s layout, but I can’t / don’t want to hardcode these things.

Ideally I want to end up with an injected Object, similiar to session, so it is easily accessible. Take this example:

// app/index/template.hbs
<img src="{{config.index.bannerUrl}}" />

Is this even possible? I’m thrilled for your suggestions.

Yup sounds like a service to me. You can even avoid injecting it everywhere in an initializer, assuming you don’t need it everywhere, by using the new inject syntax.