@@ -19,10 +19,10 @@ class CoCreateLazyLoader {
1919 }
2020
2121 async init ( ) {
22- // Function to create the scripts directory if it doesn't exist
23- async function createScriptsDirectory ( ) {
22+ const scriptsDirectory = './scripts' ;
23+
24+ if ( ! await fs . access ( scriptsDirectory ) ) {
2425 try {
25- const scriptsDirectory = './scripts' ;
2626 await fs . mkdir ( scriptsDirectory , { recursive : true } ) ;
2727 console . log ( `Scripts directory created at ${ scriptsDirectory } ` ) ;
2828 } catch ( error ) {
@@ -31,9 +31,6 @@ class CoCreateLazyLoader {
3131 }
3232 }
3333
34- // Call this function at the start of your application
35- createScriptsDirectory ( ) ;
36-
3734 this . modules = await Config ( 'modules' , false , false )
3835 if ( ! this . modules )
3936 return
@@ -76,6 +73,7 @@ class CoCreateLazyLoader {
7673
7774 hosts [ hostname ] = organization
7875
76+ // TODO: handle ssl validation here and creation here
7977 if ( valideUrl . pathname . startsWith ( '/webhooks/' ) ) {
8078 let name = req . url . split ( '/' ) [ 2 ] ; // Assuming URL structure is /webhook/name/...
8179 if ( this . modules [ name ] ) {
@@ -94,8 +92,6 @@ class CoCreateLazyLoader {
9492 res . writeHead ( 400 , { 'Content-Type' : 'text/plain' } ) ;
9593 res . end ( 'Invalid host format' ) ;
9694 }
97-
98-
9995 } )
10096
10197 }
@@ -188,7 +184,6 @@ class CoCreateLazyLoader {
188184
189185 }
190186
191-
192187}
193188
194189function getModuleDependencies ( modulePath ) {
0 commit comments