Spaces:
Running
Running
Update app/config.py
Browse files- app/config.py +19 -18
app/config.py
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
-
from pydantic_settings import BaseSettings
|
2 |
-
import os
|
3 |
-
from typing import List
|
4 |
-
|
5 |
-
class Settings(BaseSettings):
|
6 |
-
API_KEYS: List[str]
|
7 |
-
ALLOWED_TOKENS: List[str]
|
8 |
-
BASE_URL: str
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
settings = Settings(_env_file=os.getenv("ENV_FILE", ".env"))
|
|
|
1 |
+
from pydantic_settings import BaseSettings
|
2 |
+
import os
|
3 |
+
from typing import List
|
4 |
+
|
5 |
+
class Settings(BaseSettings):
|
6 |
+
API_KEYS: List[str]
|
7 |
+
ALLOWED_TOKENS: List[str]
|
8 |
+
BASE_URL: str
|
9 |
+
MODEL_SEARCH: List[str] = ["gemini-2.0-flash-exp"]
|
10 |
+
|
11 |
+
class Config:
|
12 |
+
env_file = ".env"
|
13 |
+
env_file_encoding = "utf-8"
|
14 |
+
case_sensitive = True
|
15 |
+
# 同时从环境变量和.env文件获取配置
|
16 |
+
env_nested_delimiter = "__"
|
17 |
+
extra = "ignore"
|
18 |
+
|
19 |
+
# 优先从环境变量获取,如果没有则从.env文件获取
|
20 |
settings = Settings(_env_file=os.getenv("ENV_FILE", ".env"))
|