Create a Docker Image for Web (#4533)

This commit is contained in:
Tom Rogers
2025-02-05 15:37:58 +01:00
committed by GitHub
parent e34749f666
commit ae6a25fe6d
7 changed files with 53 additions and 24 deletions

View File

@ -30,20 +30,26 @@ const baseURLRecords: BaseURLRecords = {
function serverBaseURL(env: AppEnvironment): string {
const value = baseURLRecords[appEnv].serverBaseURL
if (value.length == 0) {
throw new Error(
`Couldn't find environment variable for server base url in ${env} environment`
if (value.length == 0 && global.window) {
const windowEnv = (window as any).omnivoreEnv
console.warn(
`Couldn't find environment variable for server base url in ${env} environment, using ${windowEnv.SERVER_BASE_URL}`
)
return windowEnv.SERVER_BASE_URL ?? ''
}
return value
}
function webURL(env: AppEnvironment): string {
const value = baseURLRecords[appEnv].webBaseURL
if (value.length == 0) {
throw new Error(
`Couldn't find environment variable for web base url in ${env} environment`
if (value.length == 0 && global.window) {
const windowEnv = (window as any).omnivoreEnv
console.warn(
`Couldn't find environment variable for base url in ${env} environment, using ${windowEnv.BASE_URL}`
)
return windowEnv.BASE_URL ?? ''
}
return value
}