Merge branch 'master' into email_template_change

This commit is contained in:
einhornimmond 2025-01-27 19:41:27 +01:00
commit 0f008c3934
10 changed files with 41 additions and 41 deletions

View File

@ -55,7 +55,7 @@ FROM base as development
# Run command
# (for development we need to execute yarn install since the
# node_modules are on another volume and need updating)
CMD /bin/sh -c "cd /config && yarn install && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /config && yarn install && cd /app && yarn && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################

View File

@ -1,5 +1,4 @@
const {
browserUrls,
APP_VERSION,
BUILD_COMMIT,
BUILD_COMMIT_SHORT,
@ -12,7 +11,6 @@ const {
const Joi = require('joi')
module.exports = Joi.object({
browserUrls,
APP_VERSION,
BUILD_COMMIT,
BUILD_COMMIT_SHORT,

View File

@ -7,7 +7,7 @@ import IconsResolve from 'unplugin-icons/resolver'
import { BootstrapVueNextResolver } from 'bootstrap-vue-next'
import EnvironmentPlugin from 'vite-plugin-environment'
import schema from './src/config/schema'
import { validate } from 'gradido-config/build/src/index.js'
import { validate, browserUrls } from 'gradido-config/build/src/index.js'
import dotenv from 'dotenv'
@ -24,19 +24,15 @@ export default defineConfig(({ command }) => {
CONFIG.ADMIN_HOSTING = 'nginx'
}
// Check config
const configDataForValidation = {
...CONFIG,
// make sure that all urls used in browser have the same protocol to prevent mixed content errors
browserUrls: [
CONFIG.WALLET_AUTH_URL,
CONFIG.COMMUNITY_URL,
CONFIG.WALLET_LOGIN_URL,
CONFIG.GRAPHQL_URI,
CONFIG.ADMIN_MODULE_URL,
],
}
validate(schema, configDataForValidation)
validate(schema, CONFIG)
// make sure that all urls used in browser have the same protocol to prevent mixed content errors
validate(browserUrls, [
CONFIG.ADMIN_AUTH_URL,
CONFIG.COMMUNITY_URL,
CONFIG.COMMUNITY_REGISTER_URL,
CONFIG.GRAPHQL_URI,
CONFIG.FRONTEND_MODULE_URL,
])
return {
base: '/admin/',

View File

@ -56,7 +56,7 @@ FROM base as development
# Run command
# (for development we need to execute yarn install since the
# node_modules are on another volume and need updating)
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn build && ls ./build/ && cd /app && ls -la ../config/build && yarn install && yarn run dev"
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn install && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################

View File

@ -2,10 +2,17 @@ import Joi from 'joi'
export const browserUrls = Joi.array()
.items(Joi.string().uri())
.sparse(true)
.custom((value: string[], helpers: Joi.CustomHelpers<string[]>) => {
const protocol = new URL(value[0]).protocol
let protocol: string | undefined
for (const url of value) {
if (new URL(url).protocol !== protocol) {
if (url === undefined) {
continue
}
const urlObject = new URL(url)
if(!protocol) {
protocol = urlObject.protocol
} else if(urlObject.protocol !== protocol) {
return helpers.error('any.invalid')
}
}

View File

@ -6,19 +6,23 @@ export function validate(schema: ObjectSchema, data: any) {
const schemaJson = schema.describe()
if (error) {
error.details.forEach((err) => {
const details = JSON.stringify(err, null, 2)
if (!err.context) {
throw new Error('missing context in config validation with joi')
throw new Error('missing context in config validation with joi: ' + details)
}
if (!schemaJson) {
throw new Error('invalid schema in config validation with joi: ' + details)
}
const key = err.context.key
if (!key) {
throw new Error('missing key in config validation with joi')
if (key === undefined) {
throw new Error('missing key in config validation with joi: ' + details)
}
const value = err.context.value
const description = schemaJson.keys[key]
? schema.describe().keys[key].flags.description
: 'No description available'
if (data[key] === undefined) {
throw new Error(`Environment Variable '${key}' is missing. ${description}`)
throw new Error(`Environment Variable '${key}' is missing. ${description}, details: ${details}`)
} else {
throw new Error(
`Error on Environment Variable ${key} with value = ${value}: ${err.message}. ${description}`,

View File

@ -60,7 +60,7 @@ FROM base as development
# Run command
# (for development we need to execute yarn install since the
# node_modules are on another volume and need updating)
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn install && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################

View File

@ -57,7 +57,7 @@ FROM base as development
# Run command
# (for development we need to execute yarn install since the
# node_modules are on another volume and need updating)
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn build && cd /app && yarn install && yarn run dev"
CMD /bin/sh -c "cd /database && yarn install && yarn build && cd /config && yarn install && cd /app && yarn install && yarn run dev"
##################################################################################
# BUILD (Does contain all files and is therefore bloated) ########################

View File

@ -1,5 +1,4 @@
const {
browserUrls,
APP_VERSION,
BUILD_COMMIT,
BUILD_COMMIT_SHORT,
@ -21,7 +20,6 @@ const Joi = require('joi')
// console.log(commonSchema)
module.exports = Joi.object({
browserUrls,
APP_VERSION,
BUILD_COMMIT,
BUILD_COMMIT_SHORT,

View File

@ -8,7 +8,7 @@ import IconsResolve from 'unplugin-icons/resolver'
import EnvironmentPlugin from 'vite-plugin-environment'
import { createHtmlPlugin } from 'vite-plugin-html'
import schema from './src/config/schema'
import { validate } from 'gradido-config/build/src/index.js'
import { validate, browserUrls } from 'gradido-config/build/src/index.js'
import { BootstrapVueNextResolver } from 'bootstrap-vue-next'
import dotenv from 'dotenv'
@ -25,18 +25,15 @@ export default defineConfig(({ command }) => {
CONFIG.FRONTEND_HOSTING = 'nginx'
}
// Check config
const configDataForValidation = {
...CONFIG,
// make sure that all urls used in browser have the same protocol to prevent mixed content errors
browserUrls: [
CONFIG.ADMIN_AUTH_URL,
CONFIG.COMMUNITY_URL,
CONFIG.COMMUNITY_REGISTER_URL,
CONFIG.GRAPHQL_URI,
CONFIG.FRONTEND_MODULE_URL,
],
}
validate(schema, configDataForValidation)
validate(schema, CONFIG)
// make sure that all urls used in browser have the same protocol to prevent mixed content errors
validate(browserUrls, [
CONFIG.ADMIN_AUTH_URL,
CONFIG.COMMUNITY_URL,
CONFIG.COMMUNITY_REGISTER_URL,
CONFIG.GRAPHQL_URI,
CONFIG.FRONTEND_MODULE_URL,
])
return {
server: {