diff --git a/eth_validator_watcher/config.py b/eth_validator_watcher/config.py index fbff2f6..c2a5612 100644 --- a/eth_validator_watcher/config.py +++ b/eth_validator_watcher/config.py @@ -45,7 +45,7 @@ def load_config(config_file: str) -> Config: The effective configuration used by the watcher """ with open(config_file, 'r') as fh: - config = yaml.safe_load(fh) + config = yaml.safe_load(fh) or dict() 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 5d9fca1..e69de29 100644 --- a/tests/config/assets/config.empty.yaml +++ b/tests/config/assets/config.empty.yaml @@ -1,10 +0,0 @@ -beacon_url: ~ -beacon_type: other -execution_url: ~ -web3signer_url: ~ -default_fee_recipient: ~ -slack_channel: ~ -slack_token: ~ -relays: ~ -liveness_file: ~ -watched_keys: ~ diff --git a/tests/config/assets/config.null.yaml b/tests/config/assets/config.null.yaml new file mode 100644 index 0000000..5d9fca1 --- /dev/null +++ b/tests/config/assets/config.null.yaml @@ -0,0 +1,10 @@ +beacon_url: ~ +beacon_type: other +execution_url: ~ +web3signer_url: ~ +default_fee_recipient: ~ +slack_channel: ~ +slack_token: ~ +relays: ~ +liveness_file: ~ +watched_keys: ~ diff --git a/tests/config/test_load_config.py b/tests/config/test_load_config.py index f1a54c5..ddd8fcb 100644 --- a/tests/config/test_load_config.py +++ b/tests/config/test_load_config.py @@ -6,6 +6,22 @@ from tests.config import assets +def test_null_config() -> None: + path = Path(assets.__file__).parent / "config.null.yaml" + config = load_config(path) + + assert config.beacon_url is None + assert config.execution_url is None + assert config.web3signer_url is None + assert config.default_fee_recipient is None + assert config.slack_channel is None + assert config.slack_token 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 + + def test_empty_config() -> None: path = Path(assets.__file__).parent / "config.empty.yaml" config = load_config(path)