Spaces:
Building
Building
Update config_provider.py
Browse files- config_provider.py +6 -2
config_provider.py
CHANGED
@@ -8,8 +8,8 @@ from pathlib import Path
|
|
8 |
from typing import Any, Dict, List, Optional
|
9 |
import commentjson
|
10 |
|
11 |
-
from pydantic import BaseModel, Field, HttpUrl, ValidationError
|
12 |
from utils import log
|
|
|
13 |
from encryption_utils import decrypt
|
14 |
|
15 |
class GlobalConfig(BaseModel):
|
@@ -19,7 +19,11 @@ class GlobalConfig(BaseModel):
|
|
19 |
users: List["UserConfig"] = []
|
20 |
|
21 |
def get_plain_token(self) -> Optional[str]:
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def is_cloud_mode(self) -> bool:
|
25 |
"""Check if running in cloud mode (hfcloud or cloud)"""
|
|
|
8 |
from typing import Any, Dict, List, Optional
|
9 |
import commentjson
|
10 |
|
|
|
11 |
from utils import log
|
12 |
+
from pydantic import BaseModel, Field, HttpUrl, ValidationError
|
13 |
from encryption_utils import decrypt
|
14 |
|
15 |
class GlobalConfig(BaseModel):
|
|
|
19 |
users: List["UserConfig"] = []
|
20 |
|
21 |
def get_plain_token(self) -> Optional[str]:
|
22 |
+
if self.cloud_token:
|
23 |
+
# Lazy import to avoid circular dependency
|
24 |
+
from encryption_utils import decrypt
|
25 |
+
return decrypt(self.cloud_token)
|
26 |
+
return None
|
27 |
|
28 |
def is_cloud_mode(self) -> bool:
|
29 |
"""Check if running in cloud mode (hfcloud or cloud)"""
|