diff --git a/README.md b/README.md index cb31db5..9b0e70f 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Key | Description --- | --- game | Which game server to launch, see above path | Folder path to game server +logsPath | If set, overrides where to read logs on Windows and where to store logs on Linux. Leave empty to use default logs folders port | Web port to use host | IP or Hostname to listen on type | Which kind of server to use, can be 'linux', 'windows' or 'wine' diff --git a/app.js b/app.js index e8ddd73..62fb451 100644 --- a/app.js +++ b/app.js @@ -38,7 +38,7 @@ var missions = new Missions(config) var mods = new Mods(config) mods.updateMods() -var settings = new Settings(config) +var settings = new Settings(config, logs) app.use('/api/logs', require('./routes/logs')(logs)) app.use('/api/missions', require('./routes/missions')(missions)) diff --git a/config.js.example b/config.js.example index 2731db8..e023ad5 100644 --- a/config.js.example +++ b/config.js.example @@ -1,6 +1,7 @@ module.exports = { game: 'arma3', // arma3, arma2oa, arma2, arma1, cwa, ofpresistance, ofp path: 'path-to-arma3-directory', + logsPath: '', // fill this value if the webadmin should read game logs from a custom directory port: 3000, host: '0.0.0.0', // Can be either an IP or a Hostname type: 'linux', // Can be either linux, windows or wine diff --git a/lib/logs.js b/lib/logs.js index 3a89e63..4f8d990 100644 --- a/lib/logs.js +++ b/lib/logs.js @@ -51,6 +51,10 @@ Logs.prototype.generateLogFilePath = function (prefix, suffix) { } Logs.prototype.logsPath = function () { + if (this.config.logsPath != '') { + return this.config.logsPath; + } + if (this.config.type === 'linux') { return path.join(this.config.path, 'logs') } diff --git a/lib/settings.js b/lib/settings.js index f9ae955..1980bf6 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -1,11 +1,12 @@ var _ = require('lodash') -var Settings = function (config) { +var Settings = function (config, logs) { this.config = config + this.logsPath = logs.logsPath() } Settings.prototype.getPublicSettings = function () { - return _.pick(this.config, ['game', 'path', 'type']) + return _.merge({}, _.pick(this.config, ['game', 'path', 'type']), {logsPath: this.logsPath}) } module.exports = Settings diff --git a/public/js/tpl/settings.html b/public/js/tpl/settings.html index 9f166e4..26b942c 100644 --- a/public/js/tpl/settings.html +++ b/public/js/tpl/settings.html @@ -6,6 +6,13 @@ +
+ +
+ +
+
+