Replace 'sandbox' with 'cloud' in builder, reuse 'SELF_HOSTED' flag

This commit is contained in:
Rory Powell 2021-09-14 13:03:38 +01:00
parent 6e4c3f776d
commit 73981680ba
6 changed files with 33 additions and 736 deletions

View File

@ -92,7 +92,7 @@
<ActionGroup />
</div>
<div class="toprightnav">
{#if $admin.sandbox}
{#if $admin.cloud}
<UpgradeModal />
{/if}
<VersionModal />

View File

@ -6,7 +6,7 @@ export function createAdminStore() {
const DEFAULT_CONFIG = {
loaded: false,
multiTenancy: false,
sandbox: false,
cloud: false,
onboardingProgress: 0,
checklist: {
apps: { checked: false },
@ -45,18 +45,18 @@ export function createAdminStore() {
async function getFlags() {
let multiTenancyEnabled = false
let sandbox = false
let cloud = false
try {
const response = await api.get(`/api/system/flags`)
const json = await response.json()
multiTenancyEnabled = json.multiTenancy
sandbox = json.sandbox
cloud = json.cloud
} catch (err) {
// just let it stay disabled
}
admin.update(store => {
store.multiTenancy = multiTenancyEnabled
store.sandbox = sandbox
store.cloud = cloud
return store
})
}

View File

@ -24,6 +24,7 @@ export default ({ mode }) => {
"process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN),
"process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL),
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
"process.env.ACCOUNT_PORTAL_URL": JSON.stringify(process.env.ACCOUNT_PORTAL_URL),
}),
],
optimizeDeps: {

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@ const env = require("../../../environment")
exports.fetch = async ctx => {
ctx.body = {
multiTenancy: !!env.MULTI_TENANCY,
sandbox: !!env.SANDBOX,
cloud: !!env.SELF_HOSTED,
}
}

View File

@ -32,7 +32,6 @@ module.exports = {
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
MULTI_TENANCY: process.env.MULTI_TENANCY,
SANDBOX: process.env.SANDBOX,
_set(key, value) {
process.env[key] = value
module.exports[key] = value