move logic to cloud URL to backend
This commit is contained in:
parent
3f26814f39
commit
0c04ac58a6
|
@ -32,9 +32,6 @@ export default ({ mode }) => {
|
||||||
process.env.INTERCOM_TOKEN
|
process.env.INTERCOM_TOKEN
|
||||||
),
|
),
|
||||||
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
|
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
|
||||||
"process.env.FEATURE_PREVIEW_URL": JSON.stringify(
|
|
||||||
process.env.FEATURE_PREVIEW_URL
|
|
||||||
),
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export const buildOtherEndpoints = API => ({
|
||||||
*/
|
*/
|
||||||
checkBetaAccess: async email => {
|
checkBetaAccess: async email => {
|
||||||
return await API.get({
|
return await API.get({
|
||||||
url: `${process.env.FEATURE_PREVIEW_URL}/api/beta/access?email=${email}`,
|
url: `/api/beta/access?email=${email}`,
|
||||||
external: true,
|
external: true,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -140,6 +140,17 @@ exports.getBudibaseVersion = async ctx => {
|
||||||
|
|
||||||
// TODO: remove as part of beta program
|
// TODO: remove as part of beta program
|
||||||
exports.checkBetaAccess = async ctx => {
|
exports.checkBetaAccess = async ctx => {
|
||||||
|
// go to the cloud platform if running self hosted
|
||||||
|
if (env.SELF_HOSTED || !env.MULTI_TENANCY) {
|
||||||
|
const baseUrl = env.ACCOUNT_PORTAL_URL.replace("account.", "")
|
||||||
|
const response = await fetch(
|
||||||
|
`${baseUrl}/api/beta/access?email=${ctx.query.email}`
|
||||||
|
)
|
||||||
|
const json = await response.json()
|
||||||
|
ctx.body = json
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const userToCheck = ctx.query.email
|
const userToCheck = ctx.query.email
|
||||||
const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364"
|
const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364"
|
||||||
const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15"
|
const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15"
|
||||||
|
@ -163,6 +174,7 @@ exports.checkBetaAccess = async ctx => {
|
||||||
}
|
}
|
||||||
ctx.body = { access }
|
ctx.body = { access }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
ctx.body = { access: false }
|
ctx.body = { access: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ module.exports = {
|
||||||
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
||||||
LOGGER: process.env.LOGGER,
|
LOGGER: process.env.LOGGER,
|
||||||
LOG_LEVEL: process.env.LOG_LEVEL,
|
LOG_LEVEL: process.env.LOG_LEVEL,
|
||||||
|
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
||||||
AUTOMATION_MAX_ITERATIONS:
|
AUTOMATION_MAX_ITERATIONS:
|
||||||
parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200,
|
parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200,
|
||||||
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY,
|
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY,
|
||||||
|
|
Loading…
Reference in New Issue