2025-12-02 21:46:01 +00:00
|
|
|
import type { DeploymentMode } from "@/types/env";
|
|
|
|
|
|
|
|
|
|
export interface IEnvConfig {
|
|
|
|
|
HOST: string;
|
|
|
|
|
GLOBAL_REFRESH: number;
|
|
|
|
|
API_BASE_URL: string;
|
|
|
|
|
DEPLOYMENT_MODE: DeploymentMode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const rawRefresh = import.meta.env.VITE_APP_GLOBAL_REFRESH;
|
|
|
|
|
const parsedRefresh = Number(rawRefresh);
|
|
|
|
|
const GLOBAL_REFRESH = Number.isFinite(parsedRefresh) ? parsedRefresh : 60000;
|
|
|
|
|
|
|
|
|
|
const rawMode = import.meta.env.VITE_APP_DEPLOYMENT_MODE as
|
|
|
|
|
| DeploymentMode
|
|
|
|
|
| string
|
|
|
|
|
| undefined;
|
2025-12-09 21:27:23 +00:00
|
|
|
const normalizedMode =
|
|
|
|
|
typeof rawMode === "string" ? (rawMode as string).trim().toLowerCase() : undefined;
|
2025-12-02 21:46:01 +00:00
|
|
|
const DEPLOYMENT_MODE: DeploymentMode =
|
2025-12-09 21:27:23 +00:00
|
|
|
normalizedMode === "saas" || normalizedMode === "self_hosted"
|
|
|
|
|
? (normalizedMode as DeploymentMode)
|
|
|
|
|
: "self_hosted";
|
2025-12-02 21:46:01 +00:00
|
|
|
|
|
|
|
|
export const config: IEnvConfig = {
|
|
|
|
|
HOST: import.meta.env.VITE_APP_HOST || "http://localhost:5173",
|
|
|
|
|
GLOBAL_REFRESH,
|
|
|
|
|
API_BASE_URL:
|
|
|
|
|
import.meta.env.VITE_APP_API_BASE_URL || "http://localhost:52345/api/v1",
|
|
|
|
|
DEPLOYMENT_MODE,
|
|
|
|
|
};
|