learn-request-queue/src/config.ts

42 lines
1.4 KiB
TypeScript

import { 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!;
if (typeof process.env.YOUTUBE_SECRET == 'undefined') {
console.log("Missing environment variable YOUTUBE_SECRET");
process.exit(1);
}
export const youtubeSecret: string = process.env.YOUTUBE_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)