fix(config): move _decrypt definition before first usage
Browse files- app/config.py +13 -12
app/config.py
CHANGED
|
@@ -7,18 +7,6 @@ BLOCKED_IPS = {
|
|
| 7 |
"95.5.119.10",
|
| 8 |
}
|
| 9 |
|
| 10 |
-
# Cloudflare Turnstile for admin login protection
|
| 11 |
-
TURNSTILE_SITE_KEY = _decrypt("enc:v1:Q1ElsRjDMKIbb-7l:Q2ewoEx10wQFL-BXxTp8Xapb815hL5Iy1_H0Yz9zhQX6DTX2dTgiAA==")
|
| 12 |
-
TURNSTILE_SECRET_KEY = _decrypt("enc:v1:5AVf8i4aUlDhzWIW:_yLBFEmdzSl3FRbaNI1t0FiKA7gXWNPlsBYLCBwMh6yvKCv3wGW_Uf6ArVs9wpzUqfvt")
|
| 13 |
-
|
| 14 |
-
# Hardcoded balance endpoint map for well-known providers
|
| 15 |
-
BALANCE_ENDPOINTS = {
|
| 16 |
-
"deepseek": "https://api.deepseek.com/user/balance",
|
| 17 |
-
"openrouter": "https://openrouter.ai/api/v1/credits",
|
| 18 |
-
"openai": None, # usage-based, no public balance
|
| 19 |
-
"anthropic": None, # invoice-based
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
# ββ AES decryption ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 23 |
# Sensitive values are stored as encrypted blobs in the repo.
|
| 24 |
# Set HF Secret: AES_KEY=<base64 32-byte key>
|
|
@@ -41,6 +29,19 @@ def _decrypt(value: str) -> str:
|
|
| 41 |
raise RuntimeError(f"Failed to decrypt config value: {e}")
|
| 42 |
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# ββ Upstream URLs ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 45 |
# Each model alias maps to a list of upstreams.
|
| 46 |
# Each upstream has: url (endpoint) and model (the model name that upstream expects).
|
|
|
|
| 7 |
"95.5.119.10",
|
| 8 |
}
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# ββ AES decryption ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 11 |
# Sensitive values are stored as encrypted blobs in the repo.
|
| 12 |
# Set HF Secret: AES_KEY=<base64 32-byte key>
|
|
|
|
| 29 |
raise RuntimeError(f"Failed to decrypt config value: {e}")
|
| 30 |
|
| 31 |
|
| 32 |
+
# Cloudflare Turnstile for admin login protection
|
| 33 |
+
TURNSTILE_SITE_KEY = _decrypt("enc:v1:Q1ElsRjDMKIbb-7l:Q2ewoEx10wQFL-BXxTp8Xapb815hL5Iy1_H0Yz9zhQX6DTX2dTgiAA==")
|
| 34 |
+
TURNSTILE_SECRET_KEY = _decrypt("enc:v1:5AVf8i4aUlDhzWIW:_yLBFEmdzSl3FRbaNI1t0FiKA7gXWNPlsBYLCBwMh6yvKCv3wGW_Uf6ArVs9wpzUqfvt")
|
| 35 |
+
|
| 36 |
+
# Hardcoded balance endpoint map for well-known providers
|
| 37 |
+
BALANCE_ENDPOINTS = {
|
| 38 |
+
"deepseek": "https://api.deepseek.com/user/balance",
|
| 39 |
+
"openrouter": "https://openrouter.ai/api/v1/credits",
|
| 40 |
+
"openai": None, # usage-based, no public balance
|
| 41 |
+
"anthropic": None, # invoice-based
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
# ββ Upstream URLs ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 46 |
# Each model alias maps to a list of upstreams.
|
| 47 |
# Each upstream has: url (endpoint) and model (the model name that upstream expects).
|