mev-boost-relay icon indicating copy to clipboard operation
mev-boost-relay copied to clipboard

feat: have all config/consts together, and print on startup

Open metachris opened this issue 3 years ago • 1 comments

  • all config/consts should be together
  • in particular which can be set through env vars
  • the config should be printed on startup

metachris avatar Oct 07 '22 06:10 metachris

I've been working on a prototype to address the requirements describe above. I tried to keep it as simple as possible with the premise of not introducing any backward incompatibility.

The implementation uses Viper to configure the app either by environment variables or command flags.

What is missing?

  1. Define the output format of the config to be printed during startup. Right now is something like this:
INFO[2022-10-18T14:24:14-03:00] Config: map[ACTIVE_VALIDATOR_HOURS:3 ALLOW_SYNCING_BEACON_NODE: BEACON_URIS: BLOCKSIM_MAX_CONCURRENT:4 BLOCKSIM_URI:http://localhost:8545 DB_DONT_APPLY_SCHEMA: DB_TABLE_PREFIX:dev DEBUG_API:false DISABLE_BID_MEMORY_CACHE:false DISABLE_BLOCK_PUBLISHING:false DISABLE_LOWPRIO_BUILDERS:false ENABLE_INTERNAL_API:false FORCE_GET_HEADER_204:false GETPAYLOAD_RETRY_TIMEOUT_MS:100 LINK_BEACONCHAIN:https://beaconcha.in LINK_ETHERSCAN:https://etherscan.io LISTEN_ADDR:localhost:9060 LOG_JSON:false LOG_LEVEL:info LOG_TAG: LOG_VERSION:false NETWORK:goerli NUM_ACTIVE_VALIDATOR_PROCESSORS:10 NUM_VALIDATOR_REG_PROCESSORS:10 POSTGRES_DSN: PPROF:false PRINT_SCHEMA:false PUBKEY_OVERRIDE: REDIS_URI:localhost:6379 RELAY_URL: SECRET_KEY: SHOW_CONFIG_DETAILS:false]  service=relay/api
  1. Write tests to validate the behavior
  2. Website & API share the same LISTEN_ADDR environment variable
  3. Sensitive data should be masked or skipped when printing the configuration

Other than the missing points, the code is working and can be found at https://github.com/flashbots/mev-boost-relay/compare/main...franciscodiazydiaz:mev-boost-relay:env-config?expand=1

franciscodiazydiaz avatar Oct 18 '22 17:10 franciscodiazydiaz

Wow, very cool! Please open a PR 🙏

metachris avatar Oct 19 '22 10:10 metachris