@@ -36,6 +36,9 @@ let currentDatabaseType: string;
36
36
// Provide location to settings.json
37
37
const settingsLocation = path . resolve ( __dirname , '../../settings.json' ) ;
38
38
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.
39
42
/**
40
43
* @event connect
41
44
* @desc Connects user to database and sets global currentDatabaseType which
@@ -49,18 +52,20 @@ ipcMain.on('connect', async (message: Electron.IpcMainEvent, username: string, i
49
52
// Connect to User database instantiated in 'dashboard.ts'
50
53
if ( username !== 'guest' ) {
51
54
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
+ // })
57
60
58
61
// Check for existing user in DB, if found, connect to load application based on database type
59
62
return User . findOne ( { username : username } )
60
63
. then ( async ( data ) => {
64
+ console . log ( 'Hi, inside ipcMain.on connect in data.ts!' ) ;
61
65
const databaseType = data . services [ index ] [ 1 ]
62
66
const appURI = data . services [ index ] [ 2 ]
63
- console . log ( 'database type' , databaseType )
67
+ console . log ( 'database type' , databaseType ) ;
68
+ console . log ( 'appURI' , appURI ) ;
64
69
if ( databaseType === 'MongoDB' ) {
65
70
await connectMongo ( index , appURI )
66
71
currentDatabaseType = databaseType ;
@@ -70,6 +75,7 @@ ipcMain.on('connect', async (message: Electron.IpcMainEvent, username: string, i
70
75
currentDatabaseType = databaseType ;
71
76
message . sender . send ( 'databaseConnected' , 'connected!' ) ;
72
77
}
78
+ console . log ( 'leaving ipcMain.on connect.' )
73
79
} )
74
80
. catch ( ( error ) => {
75
81
console . log ( ` Error in connect, failed to load application : ${ error } ` )
@@ -594,12 +600,13 @@ ipcMain.on(
594
600
}
595
601
) ;
596
602
597
- // ELENA WHERE I LEFT OFF
603
+ // returns response object containing the typeOfService, region, and awsURL for a selected AWS APP
598
604
ipcMain . on (
599
605
'awsAppInfoRequest' ,
600
606
async ( message : Electron . IpcMainEvent , username : string , appIndex : number ) => {
601
-
607
+ console . log ( 'Hi, inside data.ts - awsAppInfoRequest' ) ;
602
608
if ( username !== 'guest' ) {
609
+ console . log ( 'inside awsAppInfoRequest, not a guest' ) ;
603
610
return User . findOne ( { username : username } )
604
611
. then ( ( data ) => {
605
612
console . log ( 'DB returned user data: ' , data ) ;
0 commit comments