11// FILL IN THIS INFORMATION IN .ENV
2- export const config : { [ key : string ] : string | number } = {
2+ export const runningInDevMode : boolean = process . argv . includes ( "--dev" ) ;
3+ export interface Config {
4+ updateIntervalYouTube : number ;
5+ updateIntervalTwitch : number ;
6+ }
7+
8+ export const config : Config = {
39 updateIntervalYouTube : process . env ?. CONFIG_UPDATE_INTERVAL_YOUTUBE
410 ? parseInt ( process . env ?. CONFIG_UPDATE_INTERVAL_YOUTUBE ) * 1000
511 : 60_000 ,
@@ -8,11 +14,44 @@ export const config: { [key: string]: string | number } = {
814 : 60_000 ,
915} ;
1016
11- export const env : { [ key : string ] : string | undefined } = {
12- discordToken : process . argv . includes ( "--dev" )
17+ interface Env {
18+ discordToken : string | undefined ;
19+ youtubeApiKey : string | undefined ;
20+ twitchClientId : string | undefined ;
21+ twitchClientSecret : string | undefined ;
22+ }
23+
24+ export const env : Env = {
25+ discordToken : runningInDevMode
1326 ? process . env ?. DISCORD_DEV_TOKEN
1427 : process . env ?. DISCORD_TOKEN ,
1528 youtubeApiKey : process . env ?. YOUTUBE_API_KEY ,
1629 twitchClientId : process . env ?. TWITCH_CLIENT_ID ,
1730 twitchClientSecret : process . env ?. TWITCH_CLIENT_SECRET ,
1831} ;
32+
33+ interface DatabaseConfig {
34+ host : string | undefined ;
35+ port : string | undefined ;
36+ user : string | undefined ;
37+ password : string | undefined ;
38+ database : string | undefined ;
39+ }
40+
41+ export const dbCredentials : DatabaseConfig = {
42+ host : runningInDevMode
43+ ? process . env ?. POSTGRES_DEV_HOST
44+ : process . env ?. POSTGRES_HOST ,
45+ port : runningInDevMode
46+ ? process . env ?. POSTGRES_DEV_PORT
47+ : process . env ?. POSTGRES_PORT ,
48+ user : runningInDevMode
49+ ? process . env ?. POSTGRES_DEV_USER
50+ : process . env ?. POSTGRES_USER ,
51+ password : runningInDevMode
52+ ? process . env ?. POSTGRES_DEV_PASSWORD
53+ : process . env ?. POSTGRES_PASSWORD ,
54+ database : runningInDevMode
55+ ? process . env ?. POSTGRES_DEV_DB
56+ : process . env ?. POSTGRES_DB ,
57+ } ;
0 commit comments