# Adding configuration settings

**URL:** <https://forums.bitovi.com/t/adding-configuration-settings/338>\
**Category:** StealJS\
**Created:** [July 2, 2016, 4:37pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338 "2016-07-02T16:37:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![eben\_roux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/eben_roux/32/380_2.png) [@eben\_roux](https://forums.bitovi.com/u/eben_roux)\
**Post date:** [July 2, 2016, 4:37pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/1 "2016-07-02T16:37:30Z")

</div>

In previous JavaScript applications I would add a `script` tag to include a `configuration.js` file that contains all the required settings.

The settings differ in development and production and can be changed on the server. The `html` file containing `script` to the `configuration.js` file would contain a cache busting querystring.

I have tried placing the `script` into the `development.html` but it doesn’t seem to quite work that way. It seems, rather, that steal is loading via the `app.js` (main) and then the `index.stache`. There are then failures as the `can-import` bits in the `index.stache` make use of the configuration entries that don’t yet exist.

I have tried `System.import` but, of course, the application cannot `run` before it is loaded; else I get the same errors.

Any suggestions around how I can get this sorted?

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [July 2, 2016, 4:51pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/2 "2016-07-02T16:51:33Z")

</div>

You might want to watch [https://m.youtube.com/watch?v=rLu90hJa0Fw](https://m.youtube.com/watch?v=rLu90hJa0Fw) this explains a lot, including how to setup configuration in package.json

---

<div class="post-metadata">

**Author:** ![eben\_roux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/eben_roux/32/380_2.png) [@eben\_roux](https://forums.bitovi.com/u/eben_roux)\
**Post date:** [July 2, 2016, 5:47pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/3 "2016-07-02T17:47:16Z")

</div>

Will do. Thanks Justin.

---

<div class="post-metadata">

**Author:** ![eben\_roux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/eben_roux/32/380_2.png) [@eben\_roux](https://forums.bitovi.com/u/eben_roux)\
**Post date:** [July 3, 2016, 8:59am UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/4 "2016-07-03T08:59:48Z")

</div>

Hi Justin,

This was the training from Wednesday night. I actually did watch it but it does not cover the application configuration (or I missed it).

The configuration I am referring to is not deployment configuration but rather application configuration required to enable the application to run correctly.

For instance, the url endpoint to talk to. In development I might have this:

```
var config = {
	api: "http://localhost:8080/api"
}

```

However, when I release to a server I might be going to some load-balanced endpoint:

```
var config = {
	api: "http://balanced.mydomain.com/api"
}

```

As I mentioned I would use a `<script>` tag to pull this in before the static content for the SPA. The rest of the application could use this to talk to the API.

Does this make sense? If you can point me to the time on the video where this is covered I’ll take another look.

---

<div class="post-metadata">

**Author:** ![eben\_roux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/eben_roux/32/380_2.png) [@eben\_roux](https://forums.bitovi.com/u/eben_roux)\
**Post date:** [July 3, 2016, 9:29am UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/5 "2016-07-03T09:29:15Z")

</div>

I came across this:

[http://stealjs.com/docs/System.envs.html](http://stealjs.com/docs/System.envs.html)

However, it does not quite explain how one would use it in one’s code. Also, could one then change values in an environment without rebuilding and redeploying the app; i.e. are the values somehow baked into the deployment, minified, code?

---

<div class="post-metadata">

**Author:** ![pYr0x](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/pyr0x/32/95_2.png) [@pYr0x](https://forums.bitovi.com/u/pYr0x)\
**Post date:** [July 4, 2016, 6:11pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/6 "2016-07-04T18:11:06Z")

</div>

@eben_roux @matthewp maybe we can make another steal training where @eben_roux can ask questions and we try to answer. we can publish it to youtube, so it will help other users they want to start with steal.  
i think i will this will be good because @eben_roux is a newcomer and he will ask questions may other users are interested in. so we have a focus on problems the users stumble with  
what are you thinking?

---

<div class="post-metadata">

**Author:** ![eben\_roux](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/eben_roux/32/380_2.png) [@eben\_roux](https://forums.bitovi.com/u/eben_roux)\
**Post date:** [July 5, 2016, 4:48am UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/7 "2016-07-05T04:48:03Z")

</div>

Julian, Matthew,

I have no qualms doing that as I’m sure it is going to be answering _my_ questions 🙂

I am in South Africa (GMT+2) and the steal training from last week was broadcast at 19h00 local time. I think you guys did it at 10h00 on your end. That would suit me fine. You probably have access to my e-mail address if you guys would like to set something up.

Or we could keep hammering away at the forum. 🙂

---

<div class="post-metadata">

**Author:** ![matthewp](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/matthewp/32/77_2.png) [@matthewp](https://forums.bitovi.com/u/matthewp)\
**Post date:** [July 5, 2016, 1:10pm UTC](https://forums.bitovi.com/t/adding-configuration-settings/338/8 "2016-07-05T13:10:52Z")

</div>

Yeah, that’s a good idea, let’s try to get that on the schedule soon.
