lib/config: use path.resolve instead of path.join

While paths like `tmpPath` could previously be configured,
they were all interpreted relative to `appRootPath` because
of `path.join`.

Now the configurable paths can be canonical and therefore
independent of the `appRootPath`.

Signed-off-by: WilliButz <wbutz@cyberfnord.de>
This commit is contained in:
WilliButz 2018-09-05 19:56:41 +02:00
parent e48852e0e2
commit 556783ffad
No known key found for this signature in database
GPG key ID: 92582A10F1179CB2

View file

@ -174,20 +174,20 @@ config.sslCAPath.forEach(function (capath, i, array) {
array[i] = path.resolve(appRootPath, capath) array[i] = path.resolve(appRootPath, capath)
}) })
config.sslCertPath = path.join(appRootPath, config.sslCertPath) config.sslCertPath = path.resolve(appRootPath, config.sslCertPath)
config.sslKeyPath = path.join(appRootPath, config.sslKeyPath) config.sslKeyPath = path.resolve(appRootPath, config.sslKeyPath)
config.dhParamPath = path.join(appRootPath, config.dhParamPath) config.dhParamPath = path.resolve(appRootPath, config.dhParamPath)
config.tmpPath = path.join(appRootPath, config.tmpPath) config.tmpPath = path.resolve(appRootPath, config.tmpPath)
config.defaultNotePath = path.join(appRootPath, config.defaultNotePath) config.defaultNotePath = path.resolve(appRootPath, config.defaultNotePath)
config.docsPath = path.join(appRootPath, config.docsPath) config.docsPath = path.resolve(appRootPath, config.docsPath)
config.indexPath = path.join(appRootPath, config.indexPath) config.indexPath = path.resolve(appRootPath, config.indexPath)
config.codimdPath = path.join(appRootPath, config.codimdPath) config.codimdPath = path.resolve(appRootPath, config.codimdPath)
config.errorPath = path.join(appRootPath, config.errorPath) config.errorPath = path.resolve(appRootPath, config.errorPath)
config.prettyPath = path.join(appRootPath, config.prettyPath) config.prettyPath = path.resolve(appRootPath, config.prettyPath)
config.slidePath = path.join(appRootPath, config.slidePath) config.slidePath = path.resolve(appRootPath, config.slidePath)
config.constantsPath = path.join(appRootPath, config.constantsPath) config.constantsPath = path.resolve(appRootPath, config.constantsPath)
config.uploadsPath = path.join(appRootPath, config.uploadsPath) config.uploadsPath = path.resolve(appRootPath, config.uploadsPath)
// make config readonly // make config readonly
config = deepFreeze(config) config = deepFreeze(config)