Skip to content

Commit 7db5f15

Browse files
committed
feat: add readonly check before modifying FS
1 parent 13b6b3c commit 7db5f15

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bittensor/core/settings.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
from munch import munchify
88

99

10+
READ_ONLY = os.getenv("READ_ONLY") == "1"
11+
1012
HOME_DIR = Path.home()
1113
USER_BITTENSOR_DIR = HOME_DIR / ".bittensor"
1214
WALLETS_DIR = USER_BITTENSOR_DIR / "wallets"
1315
MINERS_DIR = USER_BITTENSOR_DIR / "miners"
1416

1517

16-
# Create dirs if they don't exist
17-
WALLETS_DIR.mkdir(parents=True, exist_ok=True)
18-
MINERS_DIR.mkdir(parents=True, exist_ok=True)
18+
if not READ_ONLY:
19+
# Create dirs if they don't exist
20+
WALLETS_DIR.mkdir(parents=True, exist_ok=True)
21+
MINERS_DIR.mkdir(parents=True, exist_ok=True)
1922

2023
# Bittensor networks name
2124
NETWORKS = ["finney", "test", "archive", "local", "subvortex", "rao", "latent-lite"]

0 commit comments

Comments
 (0)