first commit
This commit is contained in:
commit
d416fe4cce
69 changed files with 8269 additions and 0 deletions
31
backend/app/core/config.py
Normal file
31
backend/app/core/config.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
from dataclasses import dataclass, field
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
backend_env_path = Path(__file__).resolve().parents[2] / ".env"
|
||||
load_dotenv(dotenv_path=backend_env_path)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Settings:
|
||||
app_name: str = os.getenv("APP_NAME", "Zero Knowledge Platform API")
|
||||
mongo_uri: str = os.getenv("MONGODB_URI", "mongodb://localhost:27017")
|
||||
mongo_db_name: str = os.getenv("MONGODB_DB_NAME", "zero_knowledge_platform")
|
||||
jwt_secret: str = os.getenv("JWT_SECRET", "replace-with-a-long-random-secret")
|
||||
jwt_algorithm: str = os.getenv("JWT_ALGORITHM", "HS256")
|
||||
access_token_expire_minutes: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "60"))
|
||||
cors_origins: list[str] = field(
|
||||
default_factory=lambda: [
|
||||
origin.strip()
|
||||
for origin in os.getenv(
|
||||
"CORS_ORIGINS",
|
||||
"http://localhost:5173,http://127.0.0.1:5173",
|
||||
).split(",")
|
||||
if origin.strip()
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Loading…
Add table
Add a link
Reference in a new issue