Add staging to CORS

This commit is contained in:
Arthur Belleville 2025-07-14 16:59:17 +02:00
parent 0510010876
commit b4ec8ac983
No known key found for this signature in database

View file

@ -1,7 +1,7 @@
import dotenv from "dotenv";
export interface AppConfig {
NODE_ENV: "development" | "production" | "test";
NODE_ENV: "development" | "production" | "test" | "staging";
PORT: number;
FRONTEND_URL: string;
SUPABASE_URL: string;
@ -28,6 +28,7 @@ function createConfig(): AppConfig {
const NODE_ENV = (process.env.NODE_ENV || "development") as
| "development"
| "production"
| "staging"
| "test";
// Base configuration
@ -64,10 +65,12 @@ function createConfig(): AppConfig {
"http://127.0.0.1:3000",
];
baseConfig.LOG_LEVEL = "debug";
} else if (NODE_ENV === "staging") {
baseConfig.CORS_ORIGIN = ["https://app-staging.xtablo.com"];
} else if (NODE_ENV === "production") {
baseConfig.CORS_ORIGIN = [
baseConfig.FRONTEND_URL,
"https://xtablo.com",
"https://app.xtablo.com",
"https://develop.xtablo-source.pages.dev",
];
baseConfig.LOG_LEVEL = "info";