mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 13:59:16 +01:00
refactor: 🚨 Remove process.exit usage
This commit is contained in:
parent
b1d8595a7c
commit
076e930369
8 changed files with 22 additions and 45 deletions
|
|
@ -150,6 +150,10 @@ export const configValidator = z.object({
|
|||
enabled: false,
|
||||
address: "",
|
||||
})
|
||||
.refine(
|
||||
(arg) => !arg.enabled || !!arg.address,
|
||||
"When proxy is enabled, address must be set",
|
||||
)
|
||||
.transform((arg) => ({
|
||||
...arg,
|
||||
address: arg.enabled ? arg.address : undefined,
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ const parsed = await configValidator.safeParseAsync(config);
|
|||
|
||||
if (!parsed.success) {
|
||||
console.error("Invalid config file:");
|
||||
console.error(fromZodError(parsed.error).message);
|
||||
// Hang until Ctrl+C is pressed
|
||||
await Bun.sleep(Number.POSITIVE_INFINITY);
|
||||
process.exit();
|
||||
throw fromZodError(parsed.error).message;
|
||||
}
|
||||
|
||||
const exportedConfig = parsed.data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue