From 00cea6788ec6bb51242e0bdbb8cb48d5fa6fff5f Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 28 Jun 2025 15:08:36 -0700 Subject: [PATCH] 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: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2346 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index f9d671a2..53dfcd90 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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();