Skip to content

Commit

Permalink
fix: config defaults when loading config
Browse files Browse the repository at this point in the history
  • Loading branch information
TGRHavoc committed May 17, 2019
1 parent cce1009 commit 0b7ef8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/src/init.js
Expand Up @@ -26,7 +26,6 @@ var _trackPlayer = null;
var playerCount = 0;
var _overlays = [];
var _disabledBlips = [];

window.changeServer = function (nameOfServer) {
console.log("Changing connected server to: " + nameOfServer);
if (!(nameOfServer in config.servers)) {
Expand All @@ -38,7 +37,6 @@ window.changeServer = function (nameOfServer) {
}

window.connectedTo = config.servers[nameOfServer];
//window.connectedTo = Object.assign(config.defaults, connectedTo);

window.connectedTo.getBlipUrl = function () {
if (this.reverseProxy && this.reverseProxy.blips) {
Expand Down Expand Up @@ -83,10 +81,12 @@ function globalInit() {

for (const serverName in config.servers) {
// Make sure all servers inherit defaults if they need
config.servers[serverName] = Object.assign(config.servers[serverName], config.defaults);
var o = Object.assign({}, config.defaults, config.servers[serverName]);
if (config.debug) console.log(o);
config.servers[serverName] = o;
}

changeServer(Object.keys(p.servers)[0]);
changeServer(Object.keys(p.servers)[0]); // Show the stuff for the first server in the config.

initMarkers();
initPage();
Expand Down

0 comments on commit 0b7ef8d

Please sign in to comment.