acecalisto3 commited on
Commit
e7a834d
·
verified ·
1 Parent(s): 9093a0c

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +27 -12
app2.py CHANGED
@@ -1,3 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import asyncio
2
  import gradio as gr
3
  import logging
@@ -19,19 +37,16 @@ from pydantic_settings import BaseSettings
19
  load_dotenv() # Load environment variables from .env file
20
 
21
  class Settings(BaseSettings):
22
- DATABASE_HOST: str = os.getenv("DATABASE_HOST", "localhost")
23
- DATABASE_PORT: int = int(os.getenv("DATABASE_PORT", 3306))
24
- DATABASE_USER: str = os.getenv("DATABASE_USER", "")
25
- DATABASE_PASSWORD: str = os.getenv("DATABASE_PASSWORD", "")
26
- DATABASE_NAME: str = os.getenv("DATABASE_NAME", "monitoring")
27
- RSS_FEED_URL: str = os.getenv("RSS_FEED_URL", "")
28
- STORAGE_LOCATION: str = os.getenv("STORAGE_LOCATION", "")
29
- CHATBOT_API_KEY: str = os.getenv("CHATBOT_API_KEY", "") # Add your chatbot API key
30
-
31
  class Config:
32
- env_file = ".env"
33
- env_file_encoding = "utf-8"
34
-
35
  settings = Settings()
36
 
37
  # --- Database Connection ---
 
1
+ from pydantic_settings import BaseSettings
2
+
3
+ class Settings(BaseSettings):
4
+ # Define the database fields explicitly
5
+ db_host: str
6
+ db_user: str
7
+ db_password: str
8
+ db_name: str
9
+
10
+ class Config:
11
+ # Optional: if you want to allow extra fields
12
+ # extra = "allow"
13
+
14
+ settings = Settings()
15
+
16
+
17
+
18
+
19
  import asyncio
20
  import gradio as gr
21
  import logging
 
37
  load_dotenv() # Load environment variables from .env file
38
 
39
  class Settings(BaseSettings):
40
+ # Define the database fields explicitly
41
+ db_host: str
42
+ db_user: str
43
+ db_password: str
44
+ db_name: str
45
+
 
 
 
46
  class Config:
47
+ # Optional: if you want to allow extra fields
48
+ extra = "allow"
49
+
50
  settings = Settings()
51
 
52
  # --- Database Connection ---