Rivalcoder
Add Files
4b022af
raw
history blame
857 Bytes
import os
from dotenv import load_dotenv
# Load environment variables from .env file (if it exists)
load_dotenv()
# Get the Gemini API key from environment variables
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
# Settings object for easy access
class Settings:
GEMINI_API_KEY: str = GEMINI_API_KEY
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
MAX_FILE_SIZE: int = int(os.getenv("MAX_FILE_SIZE", "10485760")) # 10MB default
def validate(self):
"""Validate required settings"""
if not self.GEMINI_API_KEY:
raise ValueError(
"GEMINI_API_KEY not found in environment variables. "
"Please set it in your environment or .env file."
)
settings = Settings()
# Validate settings on import (only if GEMINI_API_KEY is set)
if GEMINI_API_KEY:
settings.validate()