Set default prefix and suffix to all server names

This commit is contained in:
Björn Dahlgren 2015-08-15 13:56:43 +02:00
parent 93595dfdf0
commit fac82611dc
2 changed files with 16 additions and 2 deletions

View File

@ -7,5 +7,7 @@ module.exports = {
auth: { // If both username and password is set, HTTP Basic Auth will be used
username: '', // Username for HTTP Basic Auth
password: '', // Password for HTTP Basic Auth
}
},
prefix: "", // Prefix to all server names
suffix: "", // Suffix to all server names
};

View File

@ -18,6 +18,18 @@ var queryTypes = {
ofpresistance: 'operationflashpoint',
};
var createServerTitle = function(title) {
if (config.prefix) {
title = config.prefix + title;
}
if (config.suffix) {
title = title + config.suffix;
}
return title;
};
var Server = function (path, type, options) {
this.path = path;
this.type = type;
@ -69,7 +81,7 @@ Server.prototype.start = function() {
disableVoN: this.von ? 0 : 1,
game: config.game,
headlessClients: this.headless ? ["127.0.0.1"] : null,
hostname: this.title,
hostname: createServerTitle(this.title),
localClient: this.headless ? ["127.0.0.1"] : null,
mods: this.mods,
password: this.password,