fix: sync config with db only after connection is established (#2346)

The error message had regressed in the case where connection could not be established.

Reviewed-on: OpenWF/SpaceNinjaServer#2346
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-06-28 15:08:36 -07:00 committed by Sainan
parent 58bdb2d2ec
commit 00cea6788e

View File

@ -28,12 +28,13 @@ import { updateWorldStateCollections } from "./services/worldStateService";
JSON.stringify = JSONStringify;
validateConfig();
syncConfigWithDatabase();
mongoose
.connect(config.mongodbUrl)
.then(() => {
logger.info("Connected to MongoDB");
syncConfigWithDatabase();
startWebServer();
void updateWorldStateCollections();