Allow per-app configuration of robots.txt

https://developers.google.com/search/reference/robots_txt has
the specification

Part of #344
This commit is contained in:
Girish Ramakrishnan
2017-07-14 12:19:27 -05:00
parent 5697bcf43f
commit acd00222e5
12 changed files with 84 additions and 14 deletions

View File

@@ -57,7 +57,8 @@ function removeInternalAppFields(app) {
cnameTarget: app.cnameTarget,
xFrameOptions: app.xFrameOptions,
sso: app.sso,
debugMode: app.debugMode
debugMode: app.debugMode,
robotsTxt: app.robotsTxt
};
}
@@ -132,6 +133,8 @@ function installApp(req, res, next) {
if (('debugMode' in data) && typeof data.debugMode !== 'object') return next(new HttpError(400, 'debugMode must be an object'));
if (data.robotsTxt && typeof data.robotsTxt !== 'string') return next(new HttpError(400, 'robotsTxt must be a string'));
debug('Installing app :%j', data);
apps.install(data, auditSource(req), function (error, app) {
@@ -170,6 +173,8 @@ function configureApp(req, res, next) {
if (('debugMode' in data) && typeof data.debugMode !== 'object') return next(new HttpError(400, 'debugMode must be an object'));
if (data.robotsTxt && typeof data.robotsTxt !== 'string') return next(new HttpError(400, 'robotsTxt must be an object'));
debug('Configuring app id:%s data:%j', req.params.id, data);
apps.configure(req.params.id, data, auditSource(req), function (error) {