Redirect to account portal login page in the cloud
This commit is contained in:
parent
b10f48304a
commit
689065d2b8
|
@ -51,6 +51,7 @@ services:
|
||||||
INTERNAL_API_KEY: ${INTERNAL_API_KEY}
|
INTERNAL_API_KEY: ${INTERNAL_API_KEY}
|
||||||
REDIS_URL: redis-service:6379
|
REDIS_URL: redis-service:6379
|
||||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||||
|
ACCOUNT_PORTAL_URL: https://portal.budi.live
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/logs
|
- ./logs:/logs
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
@ -87,6 +87,8 @@ spec:
|
||||||
{{ end }}
|
{{ end }}
|
||||||
- name: SELF_HOSTED
|
- name: SELF_HOSTED
|
||||||
value: {{ .Values.globals.selfHosted | quote }}
|
value: {{ .Values.globals.selfHosted | quote }}
|
||||||
|
- name: ACCOUNT_PORTAL_URL
|
||||||
|
value: {{ .Values.globals.accountPortalUrl | quote }}
|
||||||
image: budibase/worker
|
image: budibase/worker
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
name: bbworker
|
name: bbworker
|
||||||
|
|
|
@ -89,6 +89,7 @@ globals:
|
||||||
sentryDSN: ""
|
sentryDSN: ""
|
||||||
logLevel: info
|
logLevel: info
|
||||||
selfHosted: 1
|
selfHosted: 1
|
||||||
|
accountPortalUrL: ""
|
||||||
createSecrets: true # creates an internal API key, JWT secrets and redis password for you
|
createSecrets: true # creates an internal API key, JWT secrets and redis password for you
|
||||||
|
|
||||||
# if createSecrets is set to false, you can hard-code your secrets here
|
# if createSecrets is set to false, you can hard-code your secrets here
|
||||||
|
|
|
@ -51,6 +51,12 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await organisation.init()
|
await organisation.init()
|
||||||
|
|
||||||
|
// redirect to account portal for login in the cloud
|
||||||
|
if ($admin.cloud && $admin.accountPortalUrl) {
|
||||||
|
window.location.href = $admin.accountPortalUrl
|
||||||
|
}
|
||||||
|
|
||||||
loaded = true
|
loaded = true
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,6 +7,7 @@ export function createAdminStore() {
|
||||||
loaded: false,
|
loaded: false,
|
||||||
multiTenancy: false,
|
multiTenancy: false,
|
||||||
cloud: false,
|
cloud: false,
|
||||||
|
accountPortalUrl: "",
|
||||||
onboardingProgress: 0,
|
onboardingProgress: 0,
|
||||||
checklist: {
|
checklist: {
|
||||||
apps: { checked: false },
|
apps: { checked: false },
|
||||||
|
@ -28,7 +29,7 @@ export function createAdminStore() {
|
||||||
const totalSteps = Object.keys(json).length
|
const totalSteps = Object.keys(json).length
|
||||||
const completedSteps = Object.values(json).filter(x => x?.checked).length
|
const completedSteps = Object.values(json).filter(x => x?.checked).length
|
||||||
|
|
||||||
await getFlags()
|
await getEnvironment()
|
||||||
admin.update(store => {
|
admin.update(store => {
|
||||||
store.loaded = true
|
store.loaded = true
|
||||||
store.checklist = json
|
store.checklist = json
|
||||||
|
@ -43,20 +44,23 @@ export function createAdminStore() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getFlags() {
|
async function getEnvironment() {
|
||||||
let multiTenancyEnabled = false
|
let multiTenancyEnabled = false
|
||||||
let cloud = false
|
let cloud = false
|
||||||
|
let accountPortalUrl = ""
|
||||||
try {
|
try {
|
||||||
const response = await api.get(`/api/system/flags`)
|
const response = await api.get(`/api/system/environment`)
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
multiTenancyEnabled = json.multiTenancy
|
multiTenancyEnabled = json.multiTenancy
|
||||||
cloud = json.cloud
|
cloud = json.cloud
|
||||||
|
accountPortalUrl = json.accountPortalUrl
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// just let it stay disabled
|
// just let it stay disabled
|
||||||
}
|
}
|
||||||
admin.update(store => {
|
admin.update(store => {
|
||||||
store.multiTenancy = multiTenancyEnabled
|
store.multiTenancy = multiTenancyEnabled
|
||||||
store.cloud = cloud
|
store.cloud = cloud
|
||||||
|
store.accountPortalUrl = accountPortalUrl
|
||||||
return store
|
return store
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ async function init() {
|
||||||
COUCH_DB_PASSWORD: "budibase",
|
COUCH_DB_PASSWORD: "budibase",
|
||||||
// empty string is false
|
// empty string is false
|
||||||
MULTI_TENANCY: "",
|
MULTI_TENANCY: "",
|
||||||
|
ACCOUNT_PORTAL_URL: "http://localhost:3001",
|
||||||
}
|
}
|
||||||
let envFile = ""
|
let envFile = ""
|
||||||
Object.keys(envFileJson).forEach(key => {
|
Object.keys(envFileJson).forEach(key => {
|
||||||
|
|
|
@ -3,6 +3,7 @@ const env = require("../../../environment")
|
||||||
exports.fetch = async ctx => {
|
exports.fetch = async ctx => {
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
multiTenancy: !!env.MULTI_TENANCY,
|
multiTenancy: !!env.MULTI_TENANCY,
|
||||||
cloud: !!env.SELF_HOSTED,
|
cloud: !(env.SELF_HOSTED === "1"),
|
||||||
|
accountPortalUrl: env.ACCOUNT_PORTAL_URL,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,7 +44,7 @@ const PUBLIC_ENDPOINTS = [
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
route: "api/system/flags",
|
route: "api/system/environment",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ const emailRoutes = require("./global/email")
|
||||||
const authRoutes = require("./global/auth")
|
const authRoutes = require("./global/auth")
|
||||||
const roleRoutes = require("./global/roles")
|
const roleRoutes = require("./global/roles")
|
||||||
const sessionRoutes = require("./global/sessions")
|
const sessionRoutes = require("./global/sessions")
|
||||||
const flagRoutes = require("./system/flags")
|
const environmentRoutes = require("./system/environment")
|
||||||
const tenantsRoutes = require("./system/tenants")
|
const tenantsRoutes = require("./system/tenants")
|
||||||
const appRoutes = require("./app")
|
const appRoutes = require("./app")
|
||||||
|
|
||||||
|
@ -21,5 +21,5 @@ exports.routes = [
|
||||||
emailRoutes,
|
emailRoutes,
|
||||||
sessionRoutes,
|
sessionRoutes,
|
||||||
roleRoutes,
|
roleRoutes,
|
||||||
flagRoutes,
|
environmentRoutes,
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
const Router = require("@koa/router")
|
||||||
|
const controller = require("../../controllers/system/environment")
|
||||||
|
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.get("/api/system/environment", controller.fetch)
|
||||||
|
|
||||||
|
module.exports = router
|
|
@ -1,8 +0,0 @@
|
||||||
const Router = require("@koa/router")
|
|
||||||
const controller = require("../../controllers/system/flags")
|
|
||||||
|
|
||||||
const router = Router()
|
|
||||||
|
|
||||||
router.get("/api/system/flags", controller.fetch)
|
|
||||||
|
|
||||||
module.exports = router
|
|
|
@ -32,6 +32,7 @@ module.exports = {
|
||||||
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
||||||
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
||||||
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
||||||
|
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
||||||
_set(key, value) {
|
_set(key, value) {
|
||||||
process.env[key] = value
|
process.env[key] = value
|
||||||
module.exports[key] = value
|
module.exports[key] = value
|
||||||
|
|
Loading…
Reference in New Issue