autoprovision: register cloudron when provided appstore config

This commit is contained in:
Girish Ramakrishnan
2018-11-01 22:28:32 -07:00
parent 44da148fd1
commit ff3a4f65dd
+14 -6
View File
@@ -85,16 +85,24 @@ function autoprovision(autoconf, callback) {
async.eachSeries(Object.keys(autoconf), function (key, iteratorDone) { async.eachSeries(Object.keys(autoconf), function (key, iteratorDone) {
var name; var name;
switch (key) { switch (key) {
case 'appstoreConfig': name = settings.APPSTORE_CONFIG_KEY; break; case 'appstoreConfig':
case 'caasConfig': name = settings.CAAS_CONFIG_KEY; break; if (config.provider() === 'caas') { // skip registration
case 'backupConfig': name = settings.BACKUP_CONFIG_KEY; break; settingsdb.set(settings.APPSTORE_CONFIG_KEY, JSON.stringify(autoconf[key]), iteratorDone);
} else { // register cloudron
settings.setAppstoreConfig(autoconf[key], iteratorDone);
}
break;
case 'caasConfig':
settingsdb.set(settings.CAAS_CONFIG_KEY, JSON.stringify(autoconf[key]), iteratorDone);
break;
case 'backupConfig':
debug(`autoprovision: ${name}`);
settings.setBackupConfig(autoconf[key], iteratorDone);
break;
default: default:
debug(`autoprovision: ${key} ignored`); debug(`autoprovision: ${key} ignored`);
return iteratorDone(); return iteratorDone();
} }
debug(`autoprovision: ${name}`);
settingsdb.set(name, JSON.stringify(autoconf[key]), iteratorDone);
}, function (error) { }, function (error) {
if (error) return callback(new SetupError(SetupError.INTERNAL_ERROR, error)); if (error) return callback(new SetupError(SetupError.INTERNAL_ERROR, error));