chore: add app.py for azure deploy

This commit is contained in:
Christopher Gondek 2025-10-15 11:02:39 +02:00
parent 187127458e
commit 40a92ccafd
4 changed files with 35 additions and 7 deletions

View file

@ -1,6 +1,6 @@
# Preprocessor Configuration
# Path to the preprocessor configuration YAML file
PP_CONFIG_PATH="/path/to/your/pp-config.yaml"
# Path to the preprocessor configuration YAML file (relative to project root)
PP_CONFIG_PATH="src/pp-config.yaml"
# API Keys
# API key for the preprocessor service
@ -10,8 +10,9 @@ PP_API_KEY="your-preprocessor-api-key-here"
DB_ENDPOINT_API_KEY="your-database-endpoint-api-key-here"
# Database Configuration
# Path to the SQLite database file
DB_URL="/path/to/your/database.db"
# Note: DB_PATH is automatically set based on DATA_DIR environment variable
# Local: defaults to data/database.sqlite
# Azure: set DATA_DIR=/home/_data in Azure App Settings
# Power BI Configuration
# Power BI dataset identifier

23
app.py Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python3
"""
Azure entry point for PowerOn Preprocessing App.
This file redirects to the actual application in the src directory.
"""
import os
import sys
# Add current directory to Python path
sys.path.insert(0, os.path.dirname(__file__))
# Ensure DATA_DIR exists (Azure persistent storage at /home/_data)
data_dir = os.environ.get("DATA_DIR", "/home/_data")
os.makedirs(data_dir, exist_ok=True)
print(f"Data directory ready: {data_dir}")
# Import the actual application
from src.main import app
# For Azure App Service with uvicorn, expose the app at module level
# This allows uvicorn to find it as 'app:app'
application = app

View file

@ -1,7 +1,6 @@
PP_CONFIG_PATH="/Users/christopher/Documents/Repos/vo-customer-preprocessor/src/pp-config.yaml"
PP_CONFIG_PATH="src/pp-config.yaml"
PP_API_KEY="kj823u90209mj020394jp2msakhfkjashjkf"
DB_ENDPOINT_API_KEY="ouho02j0rj2oijroi3rj2oijro23jr0990"
DB_URL="/Users/christopher/Documents/Repos/vo-customer-preprocessor/data/data_althaus.db"
POWERBI_DATASET_ID="0e72b1f1-3d32-4caa-bc1a-e523b6232343"
POWERBI_CLIENT_ID="9f6fa2cf-3fe1-4ed5-a430-bb7e408c0d87"
POWERBI_CLIENT_SECRET="Vdy8Q~Bm2_5ooy-pgYtEgvA9-LjRN2HiXFw6Ody0"

View file

@ -1,5 +1,6 @@
"""General application settings."""
import os
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
@ -21,8 +22,12 @@ class Settings(BaseSettings):
# SQLite database file path.
# For in memory, use ":memory:" (not persistent).
# Uses DATA_DIR environment variable for Azure persistent storage
DB_PATH: str = Field(
"data/database.sqlite", description="Path to the SQLite database."
default_factory=lambda: os.path.join(
os.environ.get("DATA_DIR", "data"), "database.sqlite"
),
description="Path to the SQLite database.",
)
# --- API Keys ---