Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Wallet names with hyphens when passing password through ENV vars #1949

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bittensor/keyfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def get_coldkey_password_from_environment(coldkey_name: str) -> Optional[str]:
for env_name, env_value in os.environ.items()
if (normalized_env_name := env_name.upper()).startswith("BT_COLD_PW_")
}
return envs.get(f"BT_COLD_PW_{coldkey_name.upper()}")
return envs.get(f"BT_COLD_PW_{coldkey_name.replace('-', '_').upper()}")


def decrypt_keyfile_data(
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/test_keyfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ def test_deserialize_keypair_from_keyfile_data(keyfile_setup_teardown):
def test_get_coldkey_password_from_environment(monkeypatch):
password_by_wallet = {
"WALLET": "password",
"my_wallet": "password",
"my_wallet": "password2",
"my-wallet": "password2",
}

monkeypatch.setenv("bt_cold_pw_wallet", password_by_wallet["WALLET"])
Expand Down