Adding configuration settings


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?


You might want to watch this explains a lot, including how to setup configuration in package.json


Will do. Thanks Justin.


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: ""

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.


I came across this:

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?


@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?


Julian, Matthew,

I have no qualms doing that as I’m sure it is going to be answering my questions :slight_smile:

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. :slight_smile:


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