Remove obsolete developer mode

This commit is contained in:
Johannes Zellner
2017-11-23 23:41:01 +01:00
parent 4acd0bcdac
commit 1466104681
12 changed files with 204 additions and 583 deletions

View File

@@ -18,9 +18,6 @@ exports = module.exports = {
getCloudronAvatar: getCloudronAvatar,
setCloudronAvatar: setCloudronAvatar,
getDeveloperMode: getDeveloperMode,
setDeveloperMode: setDeveloperMode,
getDynamicDnsConfig: getDynamicDnsConfig,
setDynamicDnsConfig: setDynamicDnsConfig,
@@ -51,7 +48,6 @@ exports = module.exports = {
getAll: getAll,
// booleans. if you add an entry here, be sure to fix getAll
DEVELOPER_MODE_KEY: 'developer_mode',
DYNAMIC_DNS_KEY: 'dynamic_dns',
MAIL_FROM_VALIDATION_KEY: 'mail_from_validation',
EMAIL_DIGEST: 'email_digest',
@@ -97,7 +93,6 @@ var gDefaults = (function () {
result[exports.AUTOUPDATE_PATTERN_KEY] = '00 00 1,3,5,23 * * *';
result[exports.TIME_ZONE_KEY] = 'America/Los_Angeles';
result[exports.CLOUDRON_NAME_KEY] = 'Cloudron';
result[exports.DEVELOPER_MODE_KEY] = true;
result[exports.DYNAMIC_DNS_KEY] = false;
result[exports.BACKUP_CONFIG_KEY] = {
provider: 'filesystem',
@@ -264,31 +259,6 @@ function setCloudronAvatar(avatar, callback) {
return callback(null);
}
function getDeveloperMode(callback) {
assert.strictEqual(typeof callback, 'function');
settingsdb.get(exports.DEVELOPER_MODE_KEY, function (error, enabled) {
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(null, gDefaults[exports.DEVELOPER_MODE_KEY]);
if (error) return callback(new SettingsError(SettingsError.INTERNAL_ERROR, error));
callback(null, !!enabled); // settingsdb holds string values only
});
}
function setDeveloperMode(enabled, callback) {
assert.strictEqual(typeof enabled, 'boolean');
assert.strictEqual(typeof callback, 'function');
// settingsdb takes string values only
settingsdb.set(exports.DEVELOPER_MODE_KEY, enabled ? 'enabled' : '', function (error) {
if (error) return callback(new SettingsError(SettingsError.INTERNAL_ERROR, error));
exports.events.emit(exports.DEVELOPER_MODE_KEY, enabled);
return callback(null);
});
}
function getDynamicDnsConfig(callback) {
assert.strictEqual(typeof callback, 'function');
@@ -585,7 +555,6 @@ function getAll(callback) {
settings.forEach(function (setting) { result[setting.name] = setting.value; });
// convert booleans
result[exports.DEVELOPER_MODE_KEY] = !!result[exports.DEVELOPER_MODE_KEY];
result[exports.DYNAMIC_DNS_KEY] = !!result[exports.DYNAMIC_DNS_KEY];
result[exports.MAIL_FROM_VALIDATION_KEY] = !!result[exports.MAIL_FROM_VALIDATION_KEY];