Some minor updates, making template object store URL in self hosting relative so everything just goes through the proxy, and fixing issue with API key being required to create apps in self hosting.

This commit is contained in:
mike12345567 2021-01-07 15:37:41 +00:00
parent 97dfc14007
commit 9aca697bee
5 changed files with 30 additions and 28 deletions

View File

@ -11,9 +11,7 @@ services:
BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT}
LOGO_URL: ${LOGO_URL}
PORT: 4002
HOSTING_URL: ${HOSTING_URL}
JWT_SECRET: ${JWT_SECRET}
PROXY_PORT: ${MAIN_PORT}
depends_on:
- worker-service

View File

@ -6,9 +6,7 @@ MAIN_PORT=10000
HOSTING_KEY=budibase
# This section contains customisation options
HOSTING_URL=http://localhost
LOGO_URL=https://logoipsum.com/logo/logo-15.svg
HOSTING_URL=http://localhost
# This section contains all secrets pertaining to the system
# These should be updated

View File

@ -29,6 +29,7 @@
let lastApiKey
let fetchApiKeyPromise
const validateApiKey = async apiKey => {
if (isApiKeyValid) return true
if (!apiKey) return false
// make sure we only fetch once, unless API Key is changed
@ -45,19 +46,15 @@
return isApiKeyValid
}
let submitting = false
let errors = {}
let validationErrors = {}
let validationSchemas = [
{
const apiValidation = {
apiKey: string()
.required("Please enter your API key.")
.test("valid-apikey", "This API key is invalid", validateApiKey),
},
{
}
const infoValidation = {
applicationName: string().required("Your application must have a name."),
},
{
}
const userValidation = {
email: string()
.email()
.required("Your application needs a first user."),
@ -65,7 +62,15 @@
"Please enter a password for your first user."
),
roleId: string().required("You need to select a role for your user."),
},
}
let submitting = false
let errors = {}
let validationErrors = {}
let validationSchemas = [
apiValidation,
infoValidation,
userValidation,
]
function buildStep(component) {
@ -82,9 +87,12 @@
let hostingInfo = await hostingStore.actions.fetch()
// re-init the steps based on whether self hosting or cloud hosted
if (hostingInfo.type === "self") {
isApiKeyValid = true
steps = [buildStep(Info), buildStep(User)]
} else {
steps = [buildStep(API), buildStep(Info), buildStep(User)]
validationSchemas = [
infoValidation,
userValidation,
]
}
})

View File

@ -19,8 +19,8 @@ const env = require("../../../environment")
function objectStoreUrl() {
if (env.SELF_HOSTED) {
// TODO: need a better way to handle this, probably reverse proxy
return `${env.HOSTING_URL}:${env.PROXY_PORT}/app-assets/assets`
// can use a relative url for this as all goes through the proxy (this is hosted in minio)
return `/app-assets/assets`
} else {
return "https://cdn.app.budi.live/assets"
}
@ -157,7 +157,7 @@ exports.serveApp = async function(ctx) {
title: appInfo.name,
production: env.CLOUD,
appId: ctx.params.appId,
objectStoreUrl: objectStoreUrl(ctx.params.appId),
objectStoreUrl: objectStoreUrl(),
})
const template = handlebars.compile(

View File

@ -37,8 +37,6 @@ module.exports = {
DEPLOYMENT_DB_URL: process.env.DEPLOYMENT_DB_URL,
LOCAL_TEMPLATES: process.env.LOCAL_TEMPLATES,
// self hosting features
HOSTING_URL: process.env.HOSTING_URL,
PROXY_PORT: process.env.PROXY_PORT,
LOGO_URL: process.env.LOGO_URL,
_set(key, value) {
process.env[key] = value