[#1] Add default theme env variable

This commit is contained in:
Ahmed Al-Taiar
2024-10-24 18:38:07 -04:00
parent 284a4c5520
commit 03717113f4
9 changed files with 34 additions and 2 deletions

View File

@ -9,6 +9,12 @@ import { createServer } from '@redwoodjs/api-server'
import { logger } from 'src/lib/logger'
import { handleTusUpload } from 'src/lib/tus'
enum Theme {
light = 'light',
dark = 'dark',
}
;(async () => {
const { hasFlag } = await import('country-flag-icons')
@ -17,6 +23,11 @@ import { handleTusUpload } from 'src/lib/tus'
'Invalid COUNTRY environment variable, please select a valid ISO-3166-1 alpha-2 country code\n See https://en.wikipedia.org/wiki/ISO_3166-1#Codes'
)
if (!(process.env.DEFAULT_THEME.toLowerCase() in Theme))
throw new Error(
'Invalid DEFAULT_THEME environment variable, please select either light or dark'
)
const server = await createServer({
logger,
configureApiServer: async (server) => {