better env var parser

This commit is contained in:
Nour Alharithi
2023-12-26 10:40:37 -08:00
parent 90d8347791
commit 61d1d4c6f8
2 changed files with 14 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import {
SubscriberLookup,
getPhoenixSubscriber,
getSerumSubscriber,
parsePositiveIntArray,
sleep,
} from '../utils/utils';
import {
@@ -72,12 +73,12 @@ const WS_FALLBACK_FETCH_INTERVAL = 10_000;
// comma separated list of perp market indexes to load: i.e. 0,1,2,3
const PERP_MARKETS_TO_LOAD = process.env.PERP_MARKETS_TO_LOAD
? process.env.PERP_MARKETS_TO_LOAD.split(',').map((m) => parseInt(m))
? parsePositiveIntArray(process.env.PERP_MARKETS_TO_LOAD)
: undefined;
// comma separated list of spot market indexes to load: i.e. 0,1,2,3
const SPOT_MARKETS_TO_LOAD = process.env.SPOT_MARKETS_TO_LOAD
? process.env.SPOT_MARKETS_TO_LOAD.split(',').map((m) => parseInt(m))
? parsePositiveIntArray(process.env.SPOT_MARKETS_TO_LOAD)
: undefined;
logger.info(`RPC endpoint: ${endpoint}`);