Spaces:
Sleeping

scripti_sandbox / config.py
kaurdotai's picture
Prod and local env sepearted for logged_data.csv file toa void merge conlfict.
869d534
Raw History Blame Contribute Delete
979 Bytes
# config.py
from pathlib import Path
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
# Base configuration
ENVIRONMENT: str = "local"
DEBUG: bool = False
DATA_DIR: Path = Path("./data")
# API Keys and External Services
SAMBANOVA_API_KEY: str
PUSH_TO_HUB: bool = False
# Paths and Files
DATA_FILE: Path = DATA_DIR / "logged_data.csv"
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Set data file based on environment
if not self.DATA_FILE:
self.DATA_FILE = self.DATA_DIR / f"feedback_{self.ENVIRONMENT}.csv"
# Ensure data directory exists
self.DATA_DIR.mkdir(parents=True, exist_ok=True)
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache()
def get_settings():
"""Cached settings to avoid reading .env file multiple times"""
return Settings()