livrare lot 2
This commit is contained in:
commit
8ecc78e729
763 changed files with 164593 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Read a required env var. Throws on startup if missing — never use a default
|
||||
* for credentials, hostnames, or anything that should be explicitly configured.
|
||||
*/
|
||||
export function requireEnv(name: string): string {
|
||||
const v = process.env[name];
|
||||
if (!v || v.length === 0) {
|
||||
throw new Error(`Missing required environment variable: ${name}`);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read an optional env var with a non-secret default (e.g. log level, port).
|
||||
* NEVER pass a credential or internal hostname as fallback.
|
||||
*/
|
||||
export function optionalEnv(name: string, fallback: string): string {
|
||||
return process.env[name] || fallback;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue