@@ -36,6 +36,9 @@ let currentDatabaseType: string;
3636// Provide location to settings.json
3737const settingsLocation = path . resolve ( __dirname , '../../settings.json' ) ;
3838
39+ // v10 notes: should only be calling connect for local instances. Currently, the services array is differenct for
40+ // local instances vs cloud instances but this function can still be called by cloud isntances, causing an issue.
41+ // fix below is a band-aid for now, a better solution would be optimal.
3942/**
4043 * @event connect
4144 * @desc Connects user to database and sets global currentDatabaseType which
@@ -49,18 +52,20 @@ ipcMain.on('connect', async (message: Electron.IpcMainEvent, username: string, i
4952 // Connect to User database instantiated in 'dashboard.ts'
5053 if ( username !== 'guest' ) {
5154
52- const MONGO_URI = URI
53- mongoose . connect ( MONGO_URI , {
54- useNewUrlParser : true ,
55- useUnifiedtopology : true ,
56- } )
55+ // const MONGO_URI = URI
56+ // mongoose.connect(MONGO_URI, {
57+ // useNewUrlParser: true,
58+ // useUnifiedtopology: true,
59+ // })
5760
5861 // Check for existing user in DB, if found, connect to load application based on database type
5962 return User . findOne ( { username : username } )
6063 . then ( async ( data ) => {
64+ console . log ( 'Hi, inside ipcMain.on connect in data.ts!' ) ;
6165 const databaseType = data . services [ index ] [ 1 ]
6266 const appURI = data . services [ index ] [ 2 ]
63- console . log ( 'database type' , databaseType )
67+ console . log ( 'database type' , databaseType ) ;
68+ console . log ( 'appURI' , appURI ) ;
6469 if ( databaseType === 'MongoDB' ) {
6570 await connectMongo ( index , appURI )
6671 currentDatabaseType = databaseType ;
@@ -70,6 +75,7 @@ ipcMain.on('connect', async (message: Electron.IpcMainEvent, username: string, i
7075 currentDatabaseType = databaseType ;
7176 message . sender . send ( 'databaseConnected' , 'connected!' ) ;
7277 }
78+ console . log ( 'leaving ipcMain.on connect.' )
7379 } )
7480 . catch ( ( error ) => {
7581 console . log ( ` Error in connect, failed to load application : ${ error } ` )
@@ -594,12 +600,13 @@ ipcMain.on(
594600 }
595601) ;
596602
597- // ELENA WHERE I LEFT OFF
603+ // returns response object containing the typeOfService, region, and awsURL for a selected AWS APP
598604ipcMain . on (
599605 'awsAppInfoRequest' ,
600606 async ( message : Electron . IpcMainEvent , username : string , appIndex : number ) => {
601-
607+ console . log ( 'Hi, inside data.ts - awsAppInfoRequest' ) ;
602608 if ( username !== 'guest' ) {
609+ console . log ( 'inside awsAppInfoRequest, not a guest' ) ;
603610 return User . findOne ( { username : username } )
604611 . then ( ( data ) => {
605612 console . log ( 'DB returned user data: ' , data ) ;
0 commit comments