Skip to content

Commit 015be02

Browse files
committed
Update initialization after code review
1 parent 233a3b4 commit 015be02

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/ParseServer.js

+5-20
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ class ParseServer {
8181
logging.setLogger(loggerController);
8282

8383
// Note: Tests will start to fail if any validation happens after this is called.
84-
databaseController
85-
.performInitialization()
84+
Promise.resolve()
85+
.then(async () => await databaseController.performInitialization())
8686
.then(async () => await hooksController.load())
87-
.then(() => {
87+
.then(async () => {
8888
if (cloud) {
89-
addParseCloud();
89+
await addParseCloud();
9090
if (typeof cloud === 'function') {
91-
cloud(Parse);
91+
await cloud(Parse);
9292
} else if (typeof cloud === 'string') {
9393
require(path.resolve(process.cwd(), cloud));
9494
} else {
@@ -110,21 +110,6 @@ class ParseServer {
110110
}
111111
});
112112

113-
if (cloud) {
114-
addParseCloud();
115-
if (typeof cloud === 'function') {
116-
cloud(Parse);
117-
} else if (typeof cloud === 'string') {
118-
if (process.env.npm_package_type === 'module') {
119-
import(path.resolve(process.cwd(), cloud));
120-
} else {
121-
require(path.resolve(process.cwd(), cloud));
122-
}
123-
} else {
124-
throw "argument 'cloud' must either be a string or a function";
125-
}
126-
}
127-
128113
if (security && security.enableCheck && security.enableCheckLog) {
129114
new CheckRunner(options.security).run();
130115
}

0 commit comments

Comments
 (0)