automate wellknown setup

the main reason this is under app and not domain is because it let's
the user know that an app has to be installed for the whole thing to work.

part of #703
This commit is contained in:
Girish Ramakrishnan
2020-12-22 17:19:26 -08:00
parent a8436f8784
commit 8a17e13ec4
10 changed files with 119 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ exports = module.exports = {
setMemoryLimit,
setCpuShares,
setMounts,
setWellKnown,
setAutomaticBackup,
setAutomaticUpdate,
setReverseProxyConfig,
@@ -405,7 +406,7 @@ function removeInternalFields(app) {
'location', 'domain', 'fqdn', 'mailboxName', 'mailboxDomain',
'accessRestriction', 'manifest', 'portBindings', 'iconUrl', 'memoryLimit', 'cpuShares',
'sso', 'debugMode', 'reverseProxyConfig', 'enableBackup', 'creationTime', 'updateTime', 'ts', 'tags',
'label', 'alternateDomains', 'env', 'enableAutomaticUpdate', 'dataDir', 'mounts');
'label', 'alternateDomains', 'env', 'enableAutomaticUpdate', 'dataDir', 'mounts', 'wellKnown');
}
// non-admins can only see these
@@ -982,6 +983,22 @@ function setMounts(app, mounts, auditSource, callback) {
});
}
function setWellKnown(app, wellKnown, auditSource, callback) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof wellKnown, 'object');
assert.strictEqual(typeof auditSource, 'object');
assert.strictEqual(typeof callback, 'function');
const appId = app.id;
appdb.update(appId, { wellKnown }, function (error) {
if (error) return callback(error);
eventlog.add(eventlog.ACTION_APP_CONFIGURE, auditSource, { appId, app, wellKnown });
callback();
});
}
function setEnvironment(app, env, auditSource, callback) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof env, 'object');