init commit
This commit is contained in:
53
shared/config.py
Normal file
53
shared/config.py
Normal file
@@ -0,0 +1,53 @@
|
||||
import os
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
|
||||
# Load .env file manually from project root
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Find and load .env file
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
project_root = os.path.dirname(current_dir) # Go up one level from shared/
|
||||
env_path = os.path.join(project_root, ".env")
|
||||
|
||||
if os.path.exists(env_path):
|
||||
load_dotenv(env_path)
|
||||
print(f"✅ Loaded .env from: {env_path}")
|
||||
else:
|
||||
print(f"⚠️ .env not found at: {env_path}")
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# Database
|
||||
DATABASE_URL: str = "postgresql+asyncpg://admin:password@localhost:5432/women_safety"
|
||||
|
||||
# Redis
|
||||
REDIS_URL: str = "redis://localhost:6379/0"
|
||||
|
||||
# Kafka
|
||||
KAFKA_BOOTSTRAP_SERVERS: str = "localhost:9092"
|
||||
|
||||
# JWT
|
||||
SECRET_KEY: str = "your-secret-key-change-in-production"
|
||||
ALGORITHM: str = "HS256"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
||||
|
||||
# App
|
||||
APP_NAME: str = "Women Safety App"
|
||||
DEBUG: bool = True
|
||||
API_V1_STR: str = "/api/v1"
|
||||
|
||||
# External Services
|
||||
FCM_SERVER_KEY: Optional[str] = None
|
||||
|
||||
# Security
|
||||
CORS_ORIGINS: list = ["*"] # Change in production
|
||||
|
||||
# Location
|
||||
MAX_EMERGENCY_RADIUS_KM: float = 1.0
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user