From a63e92e91fcfb5f424e041d72af282753994b401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=E1=BA=BF=20H=C6=B0ng?= Date: Mon, 14 Apr 2025 01:23:09 +0700 Subject: [PATCH] chore: prevent launching if proxy count is 0 --- .gitignore | 1 + src/index.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 3a351c2..911395d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # Castorsrm config.json +build/ # Logs diff --git a/src/index.ts b/src/index.ts index 0f58979..1803bf9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,12 @@ if (fs.existsSync("config.json")) { // Write the new config file in case we updated something. await fs.promises.writeFile("config.json", config.toJSON()); +// Validate configuration +if (config.proxy.count < 1) { + logger.error("Proxy count must be greater than 0."); + process.exit(1); +} + logger.level = process.env.LOG_LEVEL || config.logger.level; logger.info(`Logger level set to '${logger.level}'`);