14 lines
501 B
TypeScript
14 lines
501 B
TypeScript
/** The predefined environment values */
|
|
const envValue: string[] = [
|
|
"MONGOOSE_STRING", "API_PORT", "SHORTENER_PORT", "CDN_PORT", "AS_PORT"
|
|
]
|
|
|
|
/** Checks if the provided value is registered in process.env */
|
|
const isRegistered = (value: string) => process.env[value];
|
|
|
|
/** Validates the .env file */
|
|
module.exports.validate = () => {
|
|
for (let value of envValue) {
|
|
if (!isRegistered(value)) throw new Error(`Please register the environment value '${value}' in your .env file`);
|
|
}
|
|
} |