diff --git a/lib/ensl/client.js b/lib/ensl/client.js index 540a2c4..b1729f1 100644 --- a/lib/ensl/client.js +++ b/lib/ensl/client.js @@ -8,7 +8,6 @@ var Marshal = require("marsha"); var querystring = require('querystring'); var config = require(path.join(__dirname, "../../config/config")); const SECRET_TOKEN = config.secret_token; -var env = process.env.NODE_ENV || "development"; const MAP_CATEGORY = 45; const SERVER_CATEGORY = 44; @@ -18,12 +17,12 @@ function EnslClient (options) { return new EnslClient(options); } - this.baseUrl = (env === "production") ? "http://www.ensl.org" : "http://staging.ensl.org"; + this.baseUrl = config.ensl_url; } EnslClient.prototype.getUserById = (options, callback) => { var id = options.id; - var url = this.baseUrl + "/api/v1/users/" + id; + var url = this.baseUrl + "api/v1/users/" + id; return request({ url: url, json: true @@ -31,7 +30,7 @@ EnslClient.prototype.getUserById = (options, callback) => { }; EnslClient.prototype.getServers = callback => { - const url = this.baseUrl + "/api/v1/servers"; + const url = this.baseUrl + "api/v1/servers"; return request({ url: url, json: true @@ -46,7 +45,7 @@ EnslClient.prototype.getServers = callback => { }; EnslClient.prototype.getMaps = callback => { - const url = this.baseUrl + "/api/v1/maps"; + const url = this.baseUrl + "api/v1/maps"; return request({ url: url, json: true @@ -61,7 +60,7 @@ EnslClient.prototype.getMaps = callback => { }; EnslClient.prototype.getFullAvatarUri = url => { - return this.baseUrl + url; + return this.baseUrl + url.replace(/^\//, ""); }; EnslClient.parseCookies = (socket) => {