Use node path for prefix detection, not dirname of library.
This commit is contained in:
parent
dede840a59
commit
2aa6d8d9ee
|
@ -40,8 +40,8 @@ var info = {
|
|||
, externalPortInsecure: walnut.externalInsecurePort || 80 // TODO externalInsecurePort
|
||||
, localPort: walnut.localPort || 3000 // system / local network
|
||||
, trustProxy: true
|
||||
, varpath: path.join(__dirname, '..', '..', 'var')
|
||||
, etcpath: path.join(__dirname, '..', '..', 'etc')
|
||||
, varpath: path.join(process.execPath, '..', '..', 'var')
|
||||
, etcpath: path.join(process.execPath, '..', '..', 'etc')
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
|||
var crypto = require('crypto');
|
||||
|
||||
// TODO xconfx.apispath
|
||||
xconfx.restPath = path.join(__dirname, '..', '..', 'packages', 'rest');
|
||||
xconfx.apiPath = path.join(__dirname, '..', '..', 'packages', 'api');
|
||||
xconfx.appApiGrantsPath = path.join(__dirname, '..', '..', 'packages', 'client-api-grants');
|
||||
xconfx.appConfigPath = path.join(__dirname, '..', '..', 'var');
|
||||
xconfx.restPath = path.join(process.execPath, '..', '..', 'packages', 'rest');
|
||||
xconfx.apiPath = path.join(process.execPath, '..', '..', 'packages', 'api');
|
||||
xconfx.appApiGrantsPath = path.join(process.execPath, '..', '..', 'packages', 'client-api-grants');
|
||||
xconfx.appConfigPath = path.join(process.execPath, '..', '..', 'var');
|
||||
|
||||
function notConfigured(req, res) {
|
||||
var msg = "api package '" + req.pkgId + "' not configured for client uri '" + req.experienceId + "'"
|
||||
|
|
|
@ -109,7 +109,7 @@ module.exports.create = function (app, xconfx, models) {
|
|||
}
|
||||
|
||||
|
||||
var configpath = path.join(__dirname, '..', '..', 'config', config.domain + '.json');
|
||||
var configpath = path.join(process.execPath, '..', '..', 'config', config.domain + '.json');
|
||||
safeConfig = { primaryDomain: config.domain };
|
||||
xconfx.primaryDomain = safeConfig.primaryDomain;
|
||||
return fs.writeFileAsync(configpath, JSON.stringify(safeConfig, null, ' '), 'utf8').then(function () {
|
||||
|
@ -166,7 +166,7 @@ module.exports.create = function (app, xconfx, models) {
|
|||
app.post('/api/com.daplie.walnut.init', setConfig);
|
||||
|
||||
// TODO use package loader
|
||||
//app.use('/', express.static(path.join(__dirname, '..', '..', 'packages', 'pages', 'com.daplie.walnut.init')));
|
||||
//app.use('/', express.static(path.join(process.execPath, '..', '..', 'packages', 'pages', 'com.daplie.walnut.init')));
|
||||
app.use('/', express.static(path.join(__dirname, 'com.daplie.walnut.init')));
|
||||
app.use('/', function (req, res, next) {
|
||||
res.statusCode = 404;
|
||||
|
|
|
@ -168,7 +168,7 @@ module.exports.create = function (webserver, xconfx, state) {
|
|||
if (hostname && !hostsmap[hostname]) {
|
||||
hostsmap[hostname] = true;
|
||||
require('fs').writeFile(
|
||||
require('path').join(__dirname, '..', '..', 'var', 'hostnames', hostname)
|
||||
require('path').join(process.execPath, '..', '..', 'var', 'hostnames', hostname)
|
||||
, hostname
|
||||
, function () {}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue