From 2be048295e24bf653fe15c94f28e7a4e73edcb45 Mon Sep 17 00:00:00 2001 From: "s. rannou" Date: Tue, 21 Nov 2023 12:16:19 +0100 Subject: [PATCH] feat: make BeaconType compulsory with a default value --- eth_validator_watcher/config.py | 4 ++-- tests/config/assets/config.empty.yaml | 2 +- tests/config/test_load_config.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eth_validator_watcher/config.py b/eth_validator_watcher/config.py index 245d52e..fbff2f6 100644 --- a/eth_validator_watcher/config.py +++ b/eth_validator_watcher/config.py @@ -21,7 +21,7 @@ class Config(BaseSettings): model_config = SettingsConfigDict(case_sensitive=True, env_prefix='eth_watcher_') beacon_url: Optional[str] = None - beacon_type: Optional[BeaconType] = None + beacon_type: BeaconType = BeaconType.OTHER execution_url: Optional[str] = None web3signer_url: Optional[str] = None default_fee_recipient: Optional[str] = None @@ -46,7 +46,7 @@ def load_config(config_file: str) -> Config: """ with open(config_file, 'r') as fh: config = yaml.safe_load(fh) - + from_env = Config().model_dump() from_yaml = Config(**config).model_dump() diff --git a/tests/config/assets/config.empty.yaml b/tests/config/assets/config.empty.yaml index 2c57e69..5d9fca1 100644 --- a/tests/config/assets/config.empty.yaml +++ b/tests/config/assets/config.empty.yaml @@ -1,5 +1,5 @@ beacon_url: ~ -beacon_type: ~ +beacon_type: other execution_url: ~ web3signer_url: ~ default_fee_recipient: ~ diff --git a/tests/config/test_load_config.py b/tests/config/test_load_config.py index 63dae06..f1a54c5 100644 --- a/tests/config/test_load_config.py +++ b/tests/config/test_load_config.py @@ -16,7 +16,7 @@ def test_empty_config() -> None: assert config.default_fee_recipient is None assert config.slack_channel is None assert config.slack_token is None - assert config.beacon_type is None + assert config.beacon_type == BeaconType.OTHER assert config.relays is None assert config.liveness_file is None assert config.watched_keys is None