learn-request-queue/src/config.ts

37 lines
1.2 KiB
TypeScript

import * as logging from './logging';
import { log, LogLevel } from "./logging"
if (typeof process.env.PORT == 'undefined') {
console.log("Missing environment variable PORT");
process.exit(1);
}
export const port: number = parseInt(process.env.PORT as string, 10);
if (typeof process.env.URL_PREFIX == 'undefined') {
console.log("Missing environment variable URL_PREFIX");
process.exit(1);
}
export const urlPrefix: string = process.env.URL_PREFIX!;
if (typeof process.env.TWITCH_CLIENTID == 'undefined') {
console.log("Missing environment variable TWITCH_CLIENTID");
process.exit(1);
}
export const twitchClientId: string = process.env.TWITCH_CLIENTID!;
if (typeof process.env.TWITCH_SECRET == 'undefined') {
console.log("Missing environment variable TWITCH_SECRET");
process.exit(1);
}
export const twitchSecret: string = process.env.TWITCH_SECRET!;
if (typeof process.env.SESSION_SECRET == 'undefined') {
console.log("Missing environment variable SESSION_SECRET");
process.exit(1);
}
export const sessionSecret: string = process.env.SESSION_SECRET!;
export const logLevel = (process.env.LOG_LEVEL ? LogLevel[process.env.LOG_LEVEL as keyof typeof LogLevel] : LogLevel.ERROR );
console.log("Running with logLevel = " + logLevel)