hashgraph / hedera-json-rpc-relay

Implementation of Ethereum JSON-RPC APIs for Hedera
Apache License 2.0
48 stars 62 forks source link

All environment variables required by the relay should be initially loaded and validated. #3023

Open ebadiere opened 1 week ago

ebadiere commented 1 week ago

Problem

When updating CI we noticed with the configuration updates, that if an environment variable such as OPERATOR_ID was defined with not value, it would override the values in the .env file. This caused tests to fail when the relay tried to submit a transaction. Ideally, the relay to fail fast, during bootstrap if required environment variables are not set.

Solution

Consolidate environment variable loading to the start of the relay. Fail to start if any required environment variables are not set. Better to fail fast.

All environment variables should be handled in one class that can also validate them, list their usage in a --help option, and exit appropriately if a validation fails.

We should also replace environment variables with a yml settings file.

Needed validations

Implementation Steps

Alternatives

No response