Spaces:
Paused
Paused
Husnain
commited on
Create envs.py
Browse files- constants/envs.py +21 -0
constants/envs.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
from tclogger import logger, OSEnver
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
config_root = Path(__file__).parents[1] / "configs"
|
| 6 |
+
|
| 7 |
+
secrets_path = config_root / "secrets.json"
|
| 8 |
+
SECRETS = OSEnver(secrets_path)
|
| 9 |
+
|
| 10 |
+
http_proxy = SECRETS["http_proxy"]
|
| 11 |
+
if http_proxy:
|
| 12 |
+
logger.note(f"> Using proxy: {http_proxy}")
|
| 13 |
+
PROXIES = {
|
| 14 |
+
"http": http_proxy,
|
| 15 |
+
"https": http_proxy,
|
| 16 |
+
}
|
| 17 |
+
else:
|
| 18 |
+
PROXIES = None
|
| 19 |
+
|
| 20 |
+
config_path = config_root / "config.json"
|
| 21 |
+
CONFIG = OSEnver(config_path)
|