Skip to content

Commit 4f17086

Browse files
refactor: handle uncaught exception in server
1 parent 5707039 commit 4f17086

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

apps/OpenSignServer/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (process.env.USE_LOCAL !== 'TRUE') {
4040
};
4141
fsAdapter = new S3Adapter(s3Options);
4242
} catch (err) {
43-
console.log('err ', err);
43+
console.log('Please provide AWS credintials in env file! Defaulting to local storage.');
4444
fsAdapter = new FSFilesAdapter({
4545
filesSubDirectory: 'files', // optional, defaults to ./files
4646
});
@@ -74,7 +74,6 @@ if (process.env.SMTP_ENABLE) {
7474

7575
mailgunDomain = process.env.MAILGUN_DOMAIN;
7676
}
77-
7877
export const config = {
7978
databaseURI:
8079
process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',
@@ -83,14 +82,16 @@ export const config = {
8382
},
8483
appId: process.env.APP_ID || 'myAppId',
8584
maxLimit: 500,
86-
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
85+
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
8786
masterKeyIps: ['0.0.0.0/0', '::1'], // '::1'
8887
serverURL: process.env.SERVER_URL || 'http://localhost:8080/app', // Don't forget to change to https if needed
8988
verifyUserEmails: process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY ? true : false,
9089
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
9190
// Your apps name. This will appear in the subject and body of the emails that are sent.
9291
appName: 'Open Sign',
9392
allowClientClassCreation: false,
93+
allowExpiredAuthDataToken: false,
94+
encodeParseObjectInCloudFunction: true,
9495
...(process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY
9596
? {
9697
emailAdapter: {
@@ -184,7 +185,7 @@ if (!process.env.TESTING) {
184185
await server.start();
185186
app.use(mountPath, server.app);
186187
} catch (err) {
187-
console.log('Err ', err);
188+
console.log(err);
188189
}
189190
}
190191
// Mount your custom express app
@@ -209,8 +210,12 @@ if (!process.env.TESTING) {
209210
httpServer.headersTimeout = 100000; // in milliseconds
210211
httpServer.listen(port, function () {
211212
console.log('parse-server-example running on port ' + port + '.');
212-
const migrate = `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
213+
const isWindows = process.platform === 'win32';
214+
// console.log('isWindows', isWindows);
213215

216+
const migrate = isWindows
217+
? `set APPLICATION_ID=${process.env.APP_ID}&& set SERVER_URL=http://localhost:8080/app&& set MASTER_KEY=${process.env.MASTER_KEY}&& npx parse-dbtool migrate`
218+
: `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
214219
exec(migrate, (error, stdout, stderr) => {
215220
if (error) {
216221
console.error(`Error: ${error.message}`);
@@ -224,6 +229,4 @@ if (!process.env.TESTING) {
224229
console.log(`Command output: ${stdout}`);
225230
});
226231
});
227-
// This will enable the Live Query real-time server
228-
await ParseServer.createLiveQueryServer(httpServer);
229232
}

0 commit comments

Comments
 (0)