feat: Implement core application structure, AI extraction, persistence, and Telegram bot modules with updated configuration and dependencies.

This commit is contained in:
Marco Gallegos
2025-12-18 12:15:04 -06:00
parent 7276e480b0
commit 899482580e
45 changed files with 1157 additions and 225 deletions

36
app/config.py Normal file
View File

@@ -0,0 +1,36 @@
"""
Configuration loader.
Loads environment variables from a .env file and makes them available as a Config object.
"""
import os
from dotenv import load_dotenv
# Load environment variables from .env file in the project root
# Note: The path is relative to the file's location in the final `app` directory
dotenv_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
class Config:
"""
Holds the application's configuration.
"""
# Telegram Bot Token
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN")
# OpenAI API Key
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
# Supergroup ID for the bot
SUPERGROUP_ID = os.getenv("SUPERGROUP_ID")
# Database URL (e.g., "sqlite:///expenses.db")
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///../database.db")
# Log level
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
# Create a single instance of the configuration
config = Config()