Skip to content

Commit

Permalink
env parsing for numbers (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergarces authored Jun 3, 2024
1 parent fab5c81 commit 5133730
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/adapters-library/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,31 @@ const ConfigSchema = z
rpcCallTimeoutInMs: z
.number()
.default(
Number(process.env.DEFI_ADAPTERS_RPC_CALL_TIMEOUT_IN_MS) || 20000,
process.env.DEFI_ADAPTERS_RPC_CALL_TIMEOUT_IN_MS
? Number(process.env.DEFI_ADAPTERS_RPC_CALL_TIMEOUT_IN_MS)
: 10000,
),
rpcCallRetries: z
.number()
.default(Number(process.env.DEFI_ADAPTERS_RPC_CALL_RETRIES) || 1),
.default(
process.env.DEFI_ADAPTERS_RPC_CALL_RETRIES
? Number(process.env.DEFI_ADAPTERS_RPC_CALL_RETRIES)
: 0,
),
rpcGetLogsTimeoutInMs: z
.number()
.default(
Number(process.env.DEFI_ADAPTERS_RPC_GETLOGS_TIMEOUT_IN_MS) || 10000,
process.env.DEFI_ADAPTERS_RPC_GETLOGS_TIMEOUT_IN_MS
? Number(process.env.DEFI_ADAPTERS_RPC_GETLOGS_TIMEOUT_IN_MS)
: 10000,
),
rpcGetLogsRetries: z
.number()
.default(Number(process.env.DEFI_ADAPTERS_RPC_GETLOGS_RETRIES) || 1),
.default(
process.env.DEFI_ADAPTERS_RPC_GETLOGS_RETRIES
? Number(process.env.DEFI_ADAPTERS_RPC_GETLOGS_RETRIES)
: 0,
),
enableFailover: z
.boolean()
.default(process.env.DEFI_ADAPTERS_USE_FAILOVER !== 'false'),
Expand Down

0 comments on commit 5133730

Please sign in to comment.