Spaces:
Sleeping
Sleeping
Commit ·
d44c135
1
Parent(s): 5389086
feat(config): add get_settings() with lru_cache for singleton pattern
Browse files- server/config.py +5 -0
server/config.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from pydantic_settings import BaseSettings
|
|
|
|
| 2 |
|
| 3 |
class Settings(BaseSettings):
|
| 4 |
app_name: str = "RedTeamOS"
|
|
@@ -14,3 +15,7 @@ class Settings(BaseSettings):
|
|
| 14 |
class Config:
|
| 15 |
env_file = ".env"
|
| 16 |
env_file_encoding = "utf-8"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from pydantic_settings import BaseSettings
|
| 2 |
+
from functools import lru_cache
|
| 3 |
|
| 4 |
class Settings(BaseSettings):
|
| 5 |
app_name: str = "RedTeamOS"
|
|
|
|
| 15 |
class Config:
|
| 16 |
env_file = ".env"
|
| 17 |
env_file_encoding = "utf-8"
|
| 18 |
+
|
| 19 |
+
@lru_cache
|
| 20 |
+
def get_settings() -> Settings:
|
| 21 |
+
return Settings()
|