Commit
·
dc0728a
1
Parent(s):
5651110
editing the config file
Browse files- backend/core/config.py +23 -3
backend/core/config.py
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 2 |
|
| 3 |
class Settings(BaseSettings):
|
|
|
|
| 4 |
DATABASE_URL: str
|
| 5 |
-
CELERY_BROKER_URL: str
|
| 6 |
-
CELERY_RESULT_BACKEND: str
|
| 7 |
GOOGLE_API_KEY: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
settings = Settings()
|
|
|
|
| 1 |
+
# from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 2 |
+
|
| 3 |
+
# class Settings(BaseSettings):
|
| 4 |
+
# DATABASE_URL: str
|
| 5 |
+
# CELERY_BROKER_URL: str
|
| 6 |
+
# CELERY_RESULT_BACKEND: str
|
| 7 |
+
# GOOGLE_API_KEY: str
|
| 8 |
+
|
| 9 |
+
# model_config = SettingsConfigDict(env_file=".env")
|
| 10 |
+
|
| 11 |
+
# settings = Settings()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 16 |
|
| 17 |
class Settings(BaseSettings):
|
| 18 |
+
# These variables will now be loaded from the Hugging Face secrets UI
|
| 19 |
DATABASE_URL: str
|
|
|
|
|
|
|
| 20 |
GOOGLE_API_KEY: str
|
| 21 |
+
|
| 22 |
+
# These variables are hardcoded for the Hugging Face environment
|
| 23 |
+
# because Redis is running in the same container.
|
| 24 |
+
CELERY_BROKER_URL: str = "redis://localhost:6379/0"
|
| 25 |
+
CELERY_RESULT_BACKEND: str = "redis://localhost:6379/0"
|
| 26 |
|
| 27 |
+
# This tells Pydantic to first look for system environment variables,
|
| 28 |
+
# and then fall back to a .env file if one exists.
|
| 29 |
+
model_config = SettingsConfigDict(env_file=".env", env_file_encoding='utf-8', extra='ignore')
|
| 30 |
|
| 31 |
settings = Settings()
|