File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,4 +5,9 @@ BETTER_AUTH_URL=
55NODE_ENV =
66JWT_ACCESS_SECRET =
77JWT_REFRESH_SECRET =
8+ CLOUDINARY_CLOUD_NAME =
9+ CLOUDINARY_API_KEY =
10+ CLOUDINARY_API_SECRET =
11+ GITHUB_SECRET =
12+ GITHUB_CLIENT_ID =
813GITHUB_TOKEN =
Original file line number Diff line number Diff line change @@ -18,12 +18,21 @@ import projectRouter from "./routers/project.router";
1818
1919const requiredEnvVars = [
2020 'CORS_ORIGIN' ,
21- 'GITHUB_CLIENT_ID' ,
22- 'GITHUB_SECRET' ,
2321 'BETTER_AUTH_SECRET' ,
2422 'BETTER_AUTH_URL'
2523] ;
2624
25+ // OPTIONAL ENV VARS
26+ const optionalEnvVars = [ "GITHUB_CLIENT_ID" , "GITHUB_SECRET" ] ;
27+ optionalEnvVars . forEach ( ( env ) => {
28+ if ( ! process . env [ env ] ) {
29+ process . env [ env ] = "" ;
30+ }
31+ console . info ( `${ env } IS ${ process . env [ env ] ? "CONFIGURED" : "NOT CONFIGURED DEFAULTING TO EMPTY STRING" } ` ) ;
32+ } ) ;
33+
34+
35+
2736function validateEnvironment ( ) {
2837 const missing = requiredEnvVars . filter ( env => ! process . env [ env ] ) ;
2938 if ( missing . length > 0 ) {
@@ -123,9 +132,13 @@ async function startServer() {
123132 try {
124133 console . log ( '🚀 Starting DevSphere Backend...' ) ;
125134
126- validateEnvironment ( ) ;
127135
128- await checkDatabaseConnection ( ) ;
136+ // SO I FOUND OUT THAT IN VITEST THE NODE_ENV IS SET TO "test"
137+ // SO NO NEED TO SET IT MANUALLY IN GITHUB ACTIONS
138+ if ( NODE_ENV != "test" ) {
139+ validateEnvironment ( ) ;
140+ await checkDatabaseConnection ( ) ;
141+ }
129142
130143 // Start the server
131144 app . listen ( port , ( ) => {
Original file line number Diff line number Diff line change @@ -9,5 +9,5 @@ import '@/tests/01-events/02-event.test';
99import '@/tests/01-events/03-update.test' ;
1010import '@/tests/01-events/04-list.test' ;
1111import '@/tests/01-events/05-delete.test' ;
12- import '@/tests/02-member/01-create.test' ;
12+ // import '@/tests/02-member/01-create.test';
1313// import '@/tests/03-user/01-signin.test';
You can’t perform that action at this time.
0 commit comments