File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ config();
66validateEnv ( ) ;
77
88export default function validateEnv ( ) {
9- console . log ( process . env . DISCORD_APPLICATION_ID ) ;
10- envKeys . forEach ( ( key ) => {
11- console . log ( process . env [ key ] ) ;
12- if ( ! process . env [ key ] ) {
13- console . warn ( `Environment variable ${ key } is not set.` ) ;
14- }
15- } ) ;
9+ const missingEnvVars = envKeys . filter ( ( key ) => ! process . env [ key ] ) ;
10+
11+ // Logging missing environment variables and exit if any are missing
12+ if ( missingEnvVars . length > 0 ) {
13+ console . error ( `Missing environment variables: ${ missingEnvVars . join ( ', ' ) } ` ) ;
14+ process . exit ( 1 ) ; // Exit with code 1 if any required env var is missing
15+ } else {
16+ console . log ( 'All required environment variables are set.' ) ;
17+ }
1618}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ export const DISCORD_PROFILE_SERVICE_DEVELOPMENT_HELP_GROUP =
77 "1209237447083303014" ; //Change this for your local environment
88
99export const envKeys = [
10- "CURRENT_ENVIRONMENT" ,
1110 "DISCORD_APPLICATION_ID" ,
1211 "DISCORD_GUILD_ID" ,
1312 "DISCORD_TOKEN" ,
You can’t perform that action at this time.
0 commit comments