move appstore urls into appstore.js

This commit is contained in:
Girish Ramakrishnan
2023-08-04 15:34:38 +05:30
parent 37ae142a16
commit fb9d8c23e1
10 changed files with 128 additions and 128 deletions

View File

@@ -4,9 +4,6 @@ exports = module.exports = {
initCache,
// these values come from the cache
apiServerOrigin,
webServerOrigin,
consoleServerOrigin,
dashboardDomain,
setDashboardLocation,
setMailLocation,
@@ -26,50 +23,40 @@ exports = module.exports = {
getBlob,
setBlob,
// booleans. if you add an entry here, be sure to fix list()
DYNAMIC_DNS_KEY: 'dynamic_dns',
// json. if you add an entry here, be sure to fix list()
BACKUP_CONFIG_KEY: 'backup_config',
BACKUP_POLICY_KEY: 'backup_policy',
SERVICES_CONFIG_KEY: 'services_config',
EXTERNAL_LDAP_KEY: 'external_ldap_config',
DIRECTORY_SERVER_KEY: 'directory_server_config',
REGISTRY_CONFIG_KEY: 'registry_config',
IPV4_CONFIG_KEY: 'ipv4_config',
SUPPORT_CONFIG_KEY: 'support_config',
PROFILE_CONFIG_KEY: 'profile_config',
GHOSTS_CONFIG_KEY: 'ghosts_config',
REVERSE_PROXY_CONFIG_KEY: 'reverseproxy_config',
IPV6_CONFIG_KEY: 'ipv6_config',
// strings
AUTOUPDATE_PATTERN_KEY: 'autoupdate_pattern',
TIME_ZONE_KEY: 'time_zone',
OIDC_COOKIE_SECRET_KEY: 'cookie_secret',
CLOUDRON_NAME_KEY: 'cloudron_name',
LANGUAGE_KEY: 'language',
CLOUDRON_ID_KEY: 'cloudron_id',
APPSTORE_API_TOKEN_KEY: 'appstore_api_token',
APPSTORE_WEB_TOKEN_KEY: 'appstore_web_token',
FIREWALL_BLOCKLIST_KEY: 'firewall_blocklist',
TRUSTED_IPS_KEY: 'trusted_ips_key',
API_SERVER_ORIGIN_KEY: 'api_server_origin',
WEB_SERVER_ORIGIN_KEY: 'web_server_origin',
AUTOUPDATE_PATTERN_KEY: 'autoupdate_pattern',
BACKUP_CONFIG_KEY: 'backup_config',
BACKUP_POLICY_KEY: 'backup_policy',
CLOUDRON_AVATAR_KEY: 'cloudron_avatar',
CLOUDRON_ID_KEY: 'cloudron_id',
CLOUDRON_NAME_KEY: 'cloudron_name',
CONSOLE_SERVER_ORIGIN_KEY: 'console_server_origin',
DASHBOARD_DOMAIN_KEY: 'admin_domain',
DASHBOARD_FQDN_KEY: 'admin_fqdn',
DIRECTORY_SERVER_KEY: 'directory_server_config',
DYNAMIC_DNS_KEY: 'dynamic_dns',
EXTERNAL_LDAP_KEY: 'external_ldap_config',
FOOTER_KEY: 'footer',
FIREWALL_BLOCKLIST_KEY: 'firewall_blocklist',
GHOSTS_CONFIG_KEY: 'ghosts_config',
IPV4_CONFIG_KEY: 'ipv4_config',
IPV6_CONFIG_KEY: 'ipv6_config',
LANGUAGE_KEY: 'language',
MAIL_DOMAIN_KEY: 'mail_domain',
MAIL_FQDN_KEY: 'mail_fqdn',
FOOTER_KEY: 'footer',
// blobs
CLOUDRON_AVATAR_KEY: 'cloudron_avatar',
OIDC_COOKIE_SECRET_KEY: 'cookie_secret',
PROFILE_CONFIG_KEY: 'profile_config',
REGISTRY_CONFIG_KEY: 'registry_config',
REVERSE_PROXY_CONFIG_KEY: 'reverseproxy_config',
SERVICES_CONFIG_KEY: 'services_config',
SUPPORT_CONFIG_KEY: 'support_config',
TIME_ZONE_KEY: 'time_zone',
TRUSTED_IPS_KEY: 'trusted_ips_key',
WEB_SERVER_ORIGIN_KEY: 'web_server_origin',
// testing
_setApiServerOrigin: setApiServerOrigin,
_clear: clear,
_set: set
};
@@ -89,10 +76,6 @@ const gDefaults = (function () {
result[exports.MAIL_DOMAIN_KEY] = '';
result[exports.MAIL_FQDN_KEY] = '';
result[exports.API_SERVER_ORIGIN_KEY] = 'https://api.cloudron.io';
result[exports.WEB_SERVER_ORIGIN_KEY] = 'https://cloudron.io';
result[exports.CONSOLE_SERVER_ORIGIN_KEY] = 'https://console.cloudron.io';
return result;
})();
@@ -165,9 +148,6 @@ async function initCache() {
const allSettings = await list();
gCache = {
apiServerOrigin: allSettings[exports.API_SERVER_ORIGIN_KEY],
webServerOrigin: allSettings[exports.WEB_SERVER_ORIGIN_KEY],
consoleServerOrigin: allSettings[exports.CONSOLE_SERVER_ORIGIN_KEY],
dashboardDomain: allSettings[exports.DASHBOARD_DOMAIN_KEY],
dashboardFqdn: allSettings[exports.DASHBOARD_FQDN_KEY],
mailDomain: allSettings[exports.MAIL_DOMAIN_KEY],
@@ -198,17 +178,6 @@ async function setMailLocation(mailDomain, mailFqdn) {
gCache.mailFqdn = mailFqdn;
}
async function setApiServerOrigin(origin) {
assert.strictEqual(typeof origin, 'string');
await set(exports.API_SERVER_ORIGIN_KEY, origin);
gCache.apiServerOrigin = origin;
}
function apiServerOrigin() { return gCache.apiServerOrigin; }
function webServerOrigin() { return gCache.webServerOrigin; }
function consoleServerOrigin() { return gCache.consoleServerOrigin; }
function dashboardDomain() { return gCache.dashboardDomain; }
function dashboardFqdn() { return gCache.dashboardFqdn; }
function mailDomain() { return gCache.mailDomain; }