proxyAuth: inject CLOUDRON_PROXY_AUTH
This commit is contained in:
+25
-2
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user