proxyAuth: inject CLOUDRON_PROXY_AUTH

This commit is contained in:
Girish Ramakrishnan
2020-11-26 15:04:25 -08:00
parent 976f072ef4
commit 6218ee30a7
+25 -2
View File
@@ -118,8 +118,8 @@ var ADDONS = {
clear: clearPostgreSql,
},
proxyAuth: {
setup: NOOP,
teardown: NOOP,
setup: setupProxyAuth,
teardown: teardownProxyAuth,
backup: NOOP,
restore: NOOP,
clear: NOOP
@@ -1806,6 +1806,29 @@ function restoreMongoDb(app, options, callback) {
});
}
function setupProxyAuth(app, options, callback) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
debugApp(app, 'Setting up proxyAuth');
const enabled = app.sso && app.manifest.addons && app.manifest.addons.proxyAuth;
if (!enabled) return callback();
const env = [ { name: 'CLOUDRON_PROXY_AUTH', value: '1' } ];
appdb.setAddonConfig(app.id, 'proxyauth', env, callback);
}
function teardownProxyAuth(app, options, callback) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
appdb.unsetAddonConfig(app.id, 'proxyauth', callback);
}
function startRedis(existingInfra, callback) {
assert.strictEqual(typeof existingInfra, 'object');
assert.strictEqual(typeof callback, 'function');