learn-request-queue/src/config.ts

49 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-11-09 23:28:30 +00:00
import { LogLevel } from "./logging"
2020-09-19 18:24:39 +00:00
if (typeof process.env.PORT == 'undefined') {
2020-06-24 21:34:53 +00:00
console.log("Missing environment variable PORT");
process.exit(1);
}
export const port: number = parseInt(process.env.PORT as string, 10);
2020-07-04 18:29:07 +00:00
2020-09-19 18:24:39 +00:00
if (typeof process.env.URL_PREFIX == 'undefined') {
2020-07-05 18:46:41 +00:00
console.log("Missing environment variable URL_PREFIX");
process.exit(1);
}
2020-09-11 05:42:37 +00:00
export const urlPrefix: string = process.env.URL_PREFIX!;
2020-07-05 18:46:41 +00:00
2020-09-19 18:24:39 +00:00
if (typeof process.env.TWITCH_CLIENTID == 'undefined') {
2020-07-05 18:46:41 +00:00
console.log("Missing environment variable TWITCH_CLIENTID");
process.exit(1);
}
2020-09-11 05:42:37 +00:00
export const twitchClientId: string = process.env.TWITCH_CLIENTID!;
2020-07-05 18:46:41 +00:00
2020-09-19 18:24:39 +00:00
if (typeof process.env.TWITCH_SECRET == 'undefined') {
2020-07-05 02:04:21 +00:00
console.log("Missing environment variable TWITCH_SECRET");
process.exit(1);
}
2020-09-11 05:42:37 +00:00
export const twitchSecret: string = process.env.TWITCH_SECRET!;
2020-07-05 02:04:21 +00:00
2020-09-19 18:24:39 +00:00
if (typeof process.env.SESSION_SECRET == 'undefined') {
2020-07-04 18:29:07 +00:00
console.log("Missing environment variable SESSION_SECRET");
process.exit(1);
}
2020-09-11 05:42:37 +00:00
export const sessionSecret: string = process.env.SESSION_SECRET!;
2020-09-19 18:24:39 +00:00
2020-11-09 23:28:30 +00:00
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!;
2020-11-29 05:05:08 +00:00
export const logLevel = (process.env.LOG_LEVEL
? LogLevel[process.env.LOG_LEVEL as keyof typeof LogLevel]
: LogLevel.ERROR );
2020-11-29 08:24:41 +00:00
2020-11-29 05:05:08 +00:00
export const cronInterval: number = (process.env.CRON_INTERVAL
? parseInt(process.env.CRON_INTERVAL as string, 10)
: 60000);
2020-09-19 18:24:39 +00:00
console.log("Running with logLevel = " + logLevel)