Closed Luke-Rogerson closed 1 year ago
Support passing required config values via environment variables (needed for v3 architecture), in addition to config file.
Run npx ava --verbose --timeout=10m --serial --fail-fast src/cli-args.test.ts
npx ava --verbose --timeout=10m --serial --fail-fast src/cli-args.test.ts
npx tsc --skipLibCheck -p ./tsconfig.prod.json && npm run start
export ETHEREUM_ENDPOINT=https://mainnet.infura.io/v3/123 export NODE_ADDRESS=55555555d4bbbe34b470f12cb0e2cd2387f6710ec5815733005bc887c317e8cf
unset ETHEREUM_ENDPOINT unset NODE_ADDRESS
config.json
{ "EthereumEndpoint": "https://mainnet.infura.io/v3/123", "MaticEndpoint": "https://polygon-mainnet.g.alchemy.com/v2/123", "node-address": "55555555d4bbbe34b470f12cb0e2cd2387f6710ec5815733005bc887c317e8cf" }
npx tsc --skipLibCheck -p ./tsconfig.prod.json && npm run start -- --config ./config.json
What's this?
Support passing required config values via environment variables (needed for v3 architecture), in addition to config file.
Testing
Unit tests
Run
npx ava --verbose --timeout=10m --serial --fail-fast src/cli-args.test.ts
Running locally
No config file and no environment variables
npx tsc --skipLibCheck -p ./tsconfig.prod.json && npm run start
Environment variables and no config file
npx tsc --skipLibCheck -p ./tsconfig.prod.json && npm run start
Config file and no environment variables
config.json
in root of project with following:npx tsc --skipLibCheck -p ./tsconfig.prod.json && npm run start -- --config ./config.json