settings: move web/api token to appstore

This commit is contained in:
Girish Ramakrishnan
2023-08-02 20:07:03 +05:30
parent e1fd369c6d
commit be4c3575fb
3 changed files with 18 additions and 52 deletions

View File

@@ -43,12 +43,6 @@ exports = module.exports = {
getCloudronId,
setCloudronId,
getAppstoreApiToken,
setAppstoreApiToken,
getAppstoreWebToken,
setAppstoreWebToken,
getSysinfoConfig,
setSysinfoConfig,
@@ -178,8 +172,6 @@ const gDefaults = (function () {
};
result[exports.LANGUAGE_KEY] = 'en';
result[exports.CLOUDRON_ID_KEY] = '';
result[exports.APPSTORE_API_TOKEN_KEY] = '';
result[exports.APPSTORE_WEB_TOKEN_KEY] = '';
result[exports.BACKUP_CONFIG_KEY] = {
provider: 'filesystem',
backupFolder: paths.DEFAULT_BACKUP_DIR,
@@ -655,32 +647,6 @@ async function setCloudronId(cid) {
notifyChange(exports.CLOUDRON_ID_KEY, cid);
}
async function getAppstoreApiToken() {
const value = await get(exports.APPSTORE_API_TOKEN_KEY);
if (value === null) return gDefaults[exports.APPSTORE_API_TOKEN_KEY];
return value;
}
async function setAppstoreApiToken(token) {
assert.strictEqual(typeof token, 'string');
await set(exports.APPSTORE_API_TOKEN_KEY, token);
notifyChange(exports.APPSTORE_API_TOKEN_KEY, token);
}
async function getAppstoreWebToken() {
const value = await get(exports.APPSTORE_WEB_TOKEN_KEY);
if (value === null) return gDefaults[exports.APPSTORE_WEB_TOKEN_KEY];
return value;
}
async function setAppstoreWebToken(token) {
assert.strictEqual(typeof token, 'string');
await set(exports.APPSTORE_WEB_TOKEN_KEY, token);
notifyChange(exports.APPSTORE_WEB_TOKEN_KEY, token);
}
async function list() {
const settings = await database.query(`SELECT ${SETTINGS_FIELDS} FROM settings WHERE value IS NOT NULL ORDER BY name`);