From 393c31d85df49bf6c37d060ad7806dc2da3bed1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nowacki?= Date: Fri, 8 Nov 2024 14:54:35 +0100 Subject: [PATCH] move env vars check to main() --- .../read_wallet_and_substitute_config.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/bittensor_prometheus/read_wallet_and_substitute_config.py b/app/bittensor_prometheus/read_wallet_and_substitute_config.py index 0ee5579..31a1ed1 100644 --- a/app/bittensor_prometheus/read_wallet_and_substitute_config.py +++ b/app/bittensor_prometheus/read_wallet_and_substitute_config.py @@ -7,9 +7,6 @@ BITTENSOR_WALLET_NAME = os.environ.get("BITTENSOR_WALLET_NAME") BITTENSOR_WALLET_HOTKEY_NAME = os.environ.get("BITTENSOR_WALLET_HOTKEY_NAME") -if not BITTENSOR_WALLET_NAME or not BITTENSOR_WALLET_HOTKEY_NAME: - raise RuntimeError("You must set BITTENSOR_WALLET_NAME and BITTENSOR_WALLET_HOTKEY_NAME env vars") - def get_wallet() -> bittensor.wallet: wallet = bittensor.wallet( @@ -27,6 +24,8 @@ def read_and_substitute_config(hotkey: str): def main(): + if not BITTENSOR_WALLET_NAME or not BITTENSOR_WALLET_HOTKEY_NAME: + raise RuntimeError("You must set BITTENSOR_WALLET_NAME and BITTENSOR_WALLET_HOTKEY_NAME env vars") wallet = get_wallet() read_and_substitute_config(wallet.hotkey.ss58_address)