From 65aa32c21895bffc3eca25bc560496f5bc37458d Mon Sep 17 00:00:00 2001 From: alvarius Date: Fri, 26 Apr 2024 00:23:38 +0100 Subject: [PATCH] fix(store-indexer): transform env var to undefined (#2741) --- .changeset/eighty-actors-live.md | 5 +++++ packages/store-indexer/bin/parseEnv.ts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/eighty-actors-live.md diff --git a/.changeset/eighty-actors-live.md b/.changeset/eighty-actors-live.md new file mode 100644 index 0000000000..dd40897197 --- /dev/null +++ b/.changeset/eighty-actors-live.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store-indexer": patch +--- + +Added support for passing in an empty `STORE_ADDRESS=` environment variable. diff --git a/packages/store-indexer/bin/parseEnv.ts b/packages/store-indexer/bin/parseEnv.ts index 637eaa47d7..aa461a2849 100644 --- a/packages/store-indexer/bin/parseEnv.ts +++ b/packages/store-indexer/bin/parseEnv.ts @@ -12,7 +12,11 @@ export const indexerEnvSchema = z.intersection( START_BLOCK: z.coerce.bigint().nonnegative().default(0n), MAX_BLOCK_RANGE: z.coerce.bigint().positive().default(1000n), POLLING_INTERVAL: z.coerce.number().positive().default(1000), - STORE_ADDRESS: z.string().refine(isHex).optional(), + STORE_ADDRESS: z + .string() + .transform((input) => (input === "" ? undefined : input)) + .refine(isHex) + .optional(), }), z.union([ z.object({