21 lines
355 B
TypeScript
21 lines
355 B
TypeScript
const requiredEnvVars = [
|
|
'PORT'
|
|
] as const;
|
|
|
|
const getEnvVar = (key: typeof requiredEnvVars[number]): string => {
|
|
const value = process.env[key];
|
|
if (!value) {
|
|
throw new Error(`Missing ${key} env var`);
|
|
}
|
|
return value;
|
|
};
|
|
|
|
export interface Config {
|
|
port: number;
|
|
}
|
|
|
|
export const configs: Config = {
|
|
port: parseInt(getEnvVar('PORT'))
|
|
}
|
|
|