little fixes (typos, missing config, etc)
This commit is contained in:
parent
d792404d67
commit
e24dd9bac6
|
@ -63,6 +63,7 @@ var info = {
|
||||||
, trustProxy: useCaddy ? true : false
|
, trustProxy: useCaddy ? true : false
|
||||||
, lexConf: letsencrypt
|
, lexConf: letsencrypt
|
||||||
, varpath: path.join(__dirname, '..', '..', 'var')
|
, varpath: path.join(__dirname, '..', '..', 'var')
|
||||||
|
, etcpath: path.join(__dirname, '..', '..', 'etc')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,9 @@ module.exports.create = function (opts) {
|
||||||
|
|
||||||
function walkLe(domainname) {
|
function walkLe(domainname) {
|
||||||
var PromiseA = require('bluebird');
|
var PromiseA = require('bluebird');
|
||||||
|
if (!domainname) {
|
||||||
|
return PromiseA.reject(new Error('no domainname given for walkLe'));
|
||||||
|
}
|
||||||
var fs = PromiseA.promisifyAll(require('fs'));
|
var fs = PromiseA.promisifyAll(require('fs'));
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var parts = domainname.split('.'); //.replace(/^www\./, '').split('.');
|
var parts = domainname.split('.'); //.replace(/^www\./, '').split('.');
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sudo mkdir -p /srv/walnut/{certs,core,letsencrypt,lib,config}
|
sudo mkdir -p /srv/walnut/{certs,core,letsencrypt,lib,etc,config}
|
||||||
|
sudo mkdir -p /srv/walnut/etc/org.oauth3.consumer
|
||||||
|
sudo mkdir -p /srv/walnut/etc/org.oauth3.provider
|
||||||
sudo mkdir -p /srv/walnut/packages/{api,pages,services}
|
sudo mkdir -p /srv/walnut/packages/{api,pages,services}
|
||||||
sudo chown -R $(whoami):$(whoami) /srv/walnut
|
sudo chown -R $(whoami):$(whoami) /srv/walnut
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,9 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
//
|
//
|
||||||
// TODO handle /accounts/:accountId
|
// TODO handle /accounts/:accountId
|
||||||
//
|
//
|
||||||
return PromiseA.resolve(require(apipath).create({}/*pkgConf*/, deps/*pkgDeps*/, myApp/*myApp*/)).then(function (handler) {
|
return PromiseA.resolve(require(apipath).create({
|
||||||
|
etcpath: xconfx.etcpath
|
||||||
|
}/*pkgConf*/, deps/*pkgDeps*/, myApp/*myApp*/)).then(function (handler) {
|
||||||
localCache.pkgs[apiId] = { pkg: pkg, handler: handler || myApp, createdAt: Date.now() };
|
localCache.pkgs[apiId] = { pkg: pkg, handler: handler || myApp, createdAt: Date.now() };
|
||||||
localCache.pkgs[apiId].handler(req, res, next);
|
localCache.pkgs[apiId].handler(req, res, next);
|
||||||
});
|
});
|
||||||
|
|
10
lib/main.js
10
lib/main.js
|
@ -87,6 +87,16 @@ module.exports.create = function (app, xconfx, apiFactories, apiDeps) {
|
||||||
|
|
||||||
localCache.le[req.hostname] = { conf: leAuth, createdAt: Date.now() };
|
localCache.le[req.hostname] = { conf: leAuth, createdAt: Date.now() };
|
||||||
redirectHttps(req, res);
|
redirectHttps(req, res);
|
||||||
|
}, function (err) {
|
||||||
|
console.error('[Error] lib/main.js walkLe');
|
||||||
|
if (err.stack) {
|
||||||
|
console.error(err.stack);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.error(new Error('getstack').stack);
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
res.send({ error: { message: "failed to get tls certificate for '" + (req.hostname || '') + "'" } });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ module.exports.create = function (webserver, xconfx, state) {
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
, allAsync: function () {
|
, allAsync: function () {
|
||||||
return memstore.allASync().then(function (db) {
|
return memstore.allAsync().then(function (db) {
|
||||||
return Object.keys(db).filter(function (key) {
|
return Object.keys(db).filter(function (key) {
|
||||||
return 0 === key.indexOf(scope);
|
return 0 === key.indexOf(scope);
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
|
@ -98,14 +98,14 @@ module.exports.create = function (webserver, xconfx, state) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
, lengthAsync: function () {
|
, lengthAsync: function () {
|
||||||
return memstore.allASync().then(function (db) {
|
return memstore.allAsync().then(function (db) {
|
||||||
return Object.keys(db).filter(function (key) {
|
return Object.keys(db).filter(function (key) {
|
||||||
return 0 === key.indexOf(scope);
|
return 0 === key.indexOf(scope);
|
||||||
}).length;
|
}).length;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
, clearAsync: function () {
|
, clearAsync: function () {
|
||||||
return memstore.allASync().then(function (db) {
|
return memstore.allAsync().then(function (db) {
|
||||||
return Object.keys(db).filter(function (key) {
|
return Object.keys(db).filter(function (key) {
|
||||||
return 0 === key.indexOf(scope);
|
return 0 === key.indexOf(scope);
|
||||||
}).map(function (key) {
|
}).map(function (key) {
|
||||||
|
@ -145,8 +145,16 @@ module.exports.create = function (webserver, xconfx, state) {
|
||||||
, systemSqlFactory: systemFactory
|
, systemSqlFactory: systemFactory
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var hostsmap = {};
|
||||||
function log(req, res, next) {
|
function log(req, res, next) {
|
||||||
console.log('[worker/log]', req.method, req.headers.host, req.url);
|
var hostname = (req.hostname || req.headers.host || '').split(':').shift();
|
||||||
|
console.log('[worker/log]', req.method, hostname, req.url);
|
||||||
|
if (hostname && !hostsmap[hostname]) {
|
||||||
|
hostsmap[hostname] = true;
|
||||||
|
require('fs').writeFile(
|
||||||
|
require('path').join(__dirname, '..', '..', 'var', 'hostnames', hostname)
|
||||||
|
, hostname, function () {});
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"app-scoped-ids": "^1.0.1",
|
"app-scoped-ids": "^1.0.1",
|
||||||
"authcodes": "git://github.com/Daplie/authcodes.git",
|
"authcodes": "git://github.com/Daplie/authcodes.git",
|
||||||
"authenticator": "^1.0.0",
|
"authenticator": "^1.0.0",
|
||||||
"bluebird": "2.x",
|
"bluebird": "3.x",
|
||||||
"body-parser": "1.x",
|
"body-parser": "1.x",
|
||||||
"btoa": "1.x",
|
"btoa": "1.x",
|
||||||
"bytes": "^1.0.0",
|
"bytes": "^1.0.0",
|
||||||
|
@ -75,6 +75,7 @@
|
||||||
"finalhandler": "^0.3.4",
|
"finalhandler": "^0.3.4",
|
||||||
"foreachasync": "5.x",
|
"foreachasync": "5.x",
|
||||||
"fresh": "^0.2.4",
|
"fresh": "^0.2.4",
|
||||||
|
"http2": "^3.3.2",
|
||||||
"human-readable-ids": "1.x",
|
"human-readable-ids": "1.x",
|
||||||
"inherits": "^2.0.1",
|
"inherits": "^2.0.1",
|
||||||
"ipify": "^1.0.5",
|
"ipify": "^1.0.5",
|
||||||
|
|
Loading…
Reference in New Issue