From 9ea8542e597f0fc79a65b8544cdcbffc242075c4 Mon Sep 17 00:00:00 2001 From: Darren Date: Mon, 6 Jan 2014 10:10:31 +0000 Subject: [PATCH] Setting kiwi_server config via application options --- client/src/app.js | 4 ---- client/src/models/application.js | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/client/src/app.js b/client/src/app.js index 885684b..4ccca0d 100644 --- a/client/src/app.js +++ b/client/src/app.js @@ -116,10 +116,6 @@ _kiwi.global = { _kiwi.app = new _kiwi.model.Application(opts); - if (opts.kiwi_server) { - _kiwi.app.kiwi_server = opts.kiwi_server; - } - // Start the client up _kiwi.app.start(); diff --git a/client/src/models/application.js b/client/src/models/application.js index e65c2ca..cad12be 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -33,8 +33,8 @@ _kiwi.model.Application = function () { this.server_settings = options[0].server_settings || {}; this.translations = options[0].translations || {}; - // Best guess at where the kiwi server is - this.detectKiwiServer(); + // Best guess at where the kiwi server is if not already specified + this.kiwi_server = options[0].kiwi_server || this.detectKiwiServer(); // Set any default settings before anything else is applied if (this.server_settings && this.server_settings.client && this.server_settings.client.settings) { @@ -60,10 +60,10 @@ _kiwi.model.Application = function () { this.detectKiwiServer = function () { // If running from file, default to localhost:7777 by default if (window.location.protocol === 'file:') { - this.kiwi_server = 'http://localhost:7778'; + return 'http://localhost:7778'; } else { // Assume the kiwi server is on the same server - this.kiwi_server = window.location.protocol + '//' + window.location.host; + return window.location.protocol + '//' + window.location.host; } }; -- 2.25.1