Add digital catalog with shareable flipbook and ktg.montzar.ir deploy files.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import path from "node:path";
|
||||
|
||||
export type Env = {
|
||||
port: number;
|
||||
apiPort: number;
|
||||
publicBaseUrl: string;
|
||||
storageDir: string;
|
||||
databasePath: string;
|
||||
isProduction: boolean;
|
||||
};
|
||||
|
||||
export function loadEnv(overrides: Partial<NodeJS.ProcessEnv> = {}): Env {
|
||||
const read = (key: string, fallback: string) =>
|
||||
overrides[key] ?? process.env[key] ?? fallback;
|
||||
|
||||
const isProduction =
|
||||
(overrides.NODE_ENV ?? process.env.NODE_ENV) === "production";
|
||||
|
||||
return {
|
||||
port: Number(read("PORT", "3000")),
|
||||
apiPort: Number(read("API_PORT", "3010")),
|
||||
publicBaseUrl: read("PUBLIC_BASE_URL", "http://localhost:3000").replace(
|
||||
/\/$/,
|
||||
"",
|
||||
),
|
||||
storageDir: path.resolve(read("STORAGE_DIR", "./storage")),
|
||||
databasePath: path.resolve(read("DATABASE_PATH", "./data/catalogs.sqlite")),
|
||||
isProduction,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user