2020-09-19 18:24:39 +00:00
|
|
|
import * as logging from './logging';
|
|
|
|
import { log, LogLevel } from "./logging"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
export const logLevel = (process.env.LOG_LEVEL ? LogLevel[process.env.LOG_LEVEL as keyof typeof LogLevel] : LogLevel.ERROR );
|
|
|
|
|
|
|
|
console.log("Running with logLevel = " + logLevel)
|