fix(api): load server, cors configuration correclty

This commit is contained in:
2025-11-09 18:09:06 +02:00
parent 2d1c620664
commit 594b08a2d1
5 changed files with 25 additions and 21 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"cors": {
"allowedHeaders": [
"Authorization",
"Content-Type",
"accept-language",
"x-trpc-source",
"x-user-locale",
"x-user-timezone",
"x-user-country"
],
"allowMethods": ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"],
"exposeHeaders": ["Content-Length"],
"maxAge": 86400,
"origin": "%env(BASANGO_API_ALLOWED_ORIGINS)%"
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"server": {
"host": "%env(BASANGO_API_HOST)%",
"port": "%env(number:BASANGO_API_PORT)%",
"version": "1.0.0"
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ const ServerConfigurationSchema = z.object({
allowMethods: z.array(z.string()).optional(), allowMethods: z.array(z.string()).optional(),
exposeHeaders: z.array(z.string()).optional(), exposeHeaders: z.array(z.string()).optional(),
maxAge: z.number().int().min(0).optional(), maxAge: z.number().int().min(0).optional(),
origin: z.array(z.string()).default([]), origin: z.string(), //z.array(z.string()).default([]),
}), }),
server: z.object({ server: z.object({
host: z.string().default("localhost"), host: z.string().default("localhost"),
-15
View File
@@ -1,15 +0,0 @@
{
"allowedHeaders": [
"Authorization",
"Content-Type",
"accept-language",
"x-trpc-source",
"x-user-locale",
"x-user-timezone",
"x-user-country"
],
"allowMethods": ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"],
"exposeHeaders": ["Content-Length"],
"maxAge": 86400,
"origin": "%env(BASANGO_API_ALLOWED_ORIGINS)%"
}
-5
View File
@@ -1,5 +0,0 @@
{
"host": "%env(BASANGO_API_HOST)%",
"port": "%env(number:BASANGO_API_PORT)%",
"version": "1.0.0"
}