move wellKnownJson to domains
after some more thought: * If app moves to another location, user has to remember to move all this config * It's not really associated with an app. It's to do with the domain info * We can put some hints in the UI if app is missing. part of #703
This commit is contained in:
@@ -4,18 +4,18 @@ exports = module.exports = {
|
||||
get
|
||||
};
|
||||
|
||||
const apps = require('../apps.js'),
|
||||
const domains = require('../domains.js'),
|
||||
HttpError = require('connect-lastmile').HttpError;
|
||||
|
||||
function get(req, res, next) {
|
||||
const host = req.headers['host'];
|
||||
|
||||
apps.getByFqdn(host, function (error, app) {
|
||||
domains.get(host, function (error, domain) {
|
||||
if (error) return next(new HttpError(404, error.message));
|
||||
|
||||
const location = req.params[0];
|
||||
if (!app.wellKnown || !(location in app.wellKnown)) return next(new HttpError(404, 'No custom well-known config'));
|
||||
if (!domain.wellKnown || !(location in domain.wellKnown)) return next(new HttpError(404, 'No custom well-known config'));
|
||||
|
||||
res.status(200).send(app.wellKnown[location]);
|
||||
res.status(200).send(domain.wellKnown[location]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user