@@ -3,6 +3,8 @@ export const runningInDevMode: boolean = process.argv.includes("--dev");
33export interface Config {
44 updateIntervalYouTube : number ;
55 updateIntervalTwitch : number ;
6+ databaseUrl : string | undefined ;
7+ discordWaitForGuildCacheTime : number ;
68}
79
810export const config : Config = {
@@ -12,6 +14,13 @@ export const config: Config = {
1214 updateIntervalTwitch : process . env ?. CONFIG_UPDATE_INTERVAL_TWITCH
1315 ? parseInt ( process . env ?. CONFIG_UPDATE_INTERVAL_TWITCH ) * 1000
1416 : 60_000 ,
17+ databaseUrl : runningInDevMode
18+ ? process . env ?. POSTGRES_DEV_URL
19+ : process . env ?. POSTGRES_URL ,
20+ discordWaitForGuildCacheTime : process . env
21+ ?. CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME
22+ ? parseInt ( process . env ?. CONFIG_DISCORD_WAIT_FOR_GUILD_CACHE_TIME ) * 1000
23+ : 10_000 ,
1524} ;
1625
1726interface Env {
@@ -29,29 +38,3 @@ export const env: Env = {
2938 twitchClientId : process . env ?. TWITCH_CLIENT_ID ,
3039 twitchClientSecret : process . env ?. TWITCH_CLIENT_SECRET ,
3140} ;
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