Setting kiwi_server config via application options
authorDarren <darren@darrenwhitlen.com>
Mon, 6 Jan 2014 10:10:31 +0000 (10:10 +0000)
committerDarren <darren@darrenwhitlen.com>
Mon, 6 Jan 2014 10:10:31 +0000 (10:10 +0000)
client/src/app.js
client/src/models/application.js

index 885684b95cb0c1b38e1536636991b7b912183cde..4ccca0d51a2c00e5614a97d475dbc2e4b9efeeec 100644 (file)
@@ -116,10 +116,6 @@ _kiwi.global = {
 \r
             _kiwi.app = new _kiwi.model.Application(opts);\r
 \r
-            if (opts.kiwi_server) {\r
-                _kiwi.app.kiwi_server = opts.kiwi_server;\r
-            }\r
-\r
             // Start the client up\r
             _kiwi.app.start();\r
 \r
index e65c2cae2adba56c0d8e64c14b50768447940dc8..cad12beb6e121c140171012b2bf6fc4381d3fbd7 100644 (file)
@@ -33,8 +33,8 @@ _kiwi.model.Application = function () {
             this.server_settings = options[0].server_settings || {};\r
             this.translations = options[0].translations || {};\r
 \r
-            // Best guess at where the kiwi server is\r
-            this.detectKiwiServer();\r
+            // Best guess at where the kiwi server is if not already specified\r
+            this.kiwi_server = options[0].kiwi_server || this.detectKiwiServer();\r
 \r
             // Set any default settings before anything else is applied\r
             if (this.server_settings && this.server_settings.client && this.server_settings.client.settings) {\r
@@ -60,10 +60,10 @@ _kiwi.model.Application = function () {
         this.detectKiwiServer = function () {\r
             // If running from file, default to localhost:7777 by default\r
             if (window.location.protocol === 'file:') {\r
-                this.kiwi_server = 'http://localhost:7778';\r
+                return 'http://localhost:7778';\r
             } else {\r
                 // Assume the kiwi server is on the same server\r
-                this.kiwi_server = window.location.protocol + '//' + window.location.host;\r
+                return window.location.protocol + '//' + window.location.host;\r
             }\r
         };\r
 \r