From 9c599b87bb02db5ae9a9389085b61bde48af9e4a Mon Sep 17 00:00:00 2001 From: alvarius Date: Fri, 26 Apr 2024 01:02:29 +0100 Subject: [PATCH] fix(store-indexer): allow empty env variable (#2746) --- .changeset/eighty-actors-live.md | 3 ++- packages/store-indexer/bin/parseEnv.ts | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.changeset/eighty-actors-live.md b/.changeset/eighty-actors-live.md index dd40897197..df0ec3bd03 100644 --- a/.changeset/eighty-actors-live.md +++ b/.changeset/eighty-actors-live.md @@ -2,4 +2,5 @@ "@latticexyz/store-indexer": patch --- -Added support for passing in an empty `STORE_ADDRESS=` environment variable. +Added support for an empty `STORE_ADDRESS=` environment variable. +This previously would fail the input validation, now it behaves the same way as not setting the `STORE_ADDRESS` variable at all. diff --git a/packages/store-indexer/bin/parseEnv.ts b/packages/store-indexer/bin/parseEnv.ts index aa461a2849..5f58e3efa1 100644 --- a/packages/store-indexer/bin/parseEnv.ts +++ b/packages/store-indexer/bin/parseEnv.ts @@ -14,8 +14,7 @@ export const indexerEnvSchema = z.intersection( POLLING_INTERVAL: z.coerce.number().positive().default(1000), STORE_ADDRESS: z .string() - .transform((input) => (input === "" ? undefined : input)) - .refine(isHex) + .refine((value) => value === "" || isHex(value)) .optional(), }), z.union([