bmc_hub/app/core/config.py
Christian 18b0fe9c05 feat: Enhance billing frontend with Jinja2 templates and improve invoice handling
- Updated billing frontend views to use Jinja2 templates for rendering HTML pages.
- Added support for displaying supplier invoices, template builder, and templates list with titles.
- Introduced a new configuration setting for company CVR number.
- Enhanced OllamaService to support credit notes in invoice extraction, including detailed JSON output format.
- Improved PDF text extraction using pdfplumber for better layout handling.
- Added a modal for editing vendor details with comprehensive fields and validation.
- Implemented invoice loading and display functionality in vendor detail view.
- Updated vendor management to remove priority handling and improve error messaging.
- Added tests for AI analyze endpoint and CVR filtering to ensure correct behavior.
- Created migration script to support credit notes in the database schema.
2025-12-08 09:15:52 +01:00

55 lines
1.5 KiB
Python

"""
Configuration Module
Handles environment variables and application settings
"""
import os
from typing import List
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings loaded from environment variables"""
# Database
DATABASE_URL: str = "postgresql://bmc_hub:bmc_hub@localhost:5432/bmc_hub"
# API
API_HOST: str = "0.0.0.0"
API_PORT: int = 8000
# Security
SECRET_KEY: str = "dev-secret-key-change-in-production"
ALLOWED_ORIGINS: List[str] = ["http://localhost:8000", "http://localhost:3000"]
# Logging
LOG_LEVEL: str = "INFO"
LOG_FILE: str = "logs/app.log"
# e-conomic Integration
ECONOMIC_API_URL: str = "https://restapi.e-conomic.com"
ECONOMIC_APP_SECRET_TOKEN: str = ""
ECONOMIC_AGREEMENT_GRANT_TOKEN: str = ""
ECONOMIC_READ_ONLY: bool = True
ECONOMIC_DRY_RUN: bool = True
# Ollama AI Integration
OLLAMA_ENDPOINT: str = "http://ai_direct.cs.blaahund.dk"
OLLAMA_MODEL: str = "qwen2.5:3b" # Hurtigere model til JSON extraction
# Company Info
OWN_CVR: str = "29522790" # BMC Denmark ApS - ignore when detecting vendors
# File Upload
UPLOAD_DIR: str = "uploads"
MAX_FILE_SIZE_MB: int = 50
ALLOWED_EXTENSIONS: List[str] = [".pdf", ".png", ".jpg", ".jpeg", ".txt", ".csv"]
class Config:
env_file = ".env"
case_sensitive = True
extra = "ignore" # Ignore extra fields from .env
settings = Settings()