feat!: generic defaults, dashboard fallback, PV filter fix (v1.3.0)

- Replace all hardcoded Tianpu/天普 defaults with generic "EMS Platform"
- Add energy_today fallback: query raw energy_data when daily summary empty
- Fix PV device filter to include sungrow_inverter device type
- Update APP_NAME, CUSTOMER default, SECRET_KEY, SMTP, Celery, email templates

BREAKING: CUSTOMER default changed from "tianpu" to "default"
Existing deployments with CUSTOMER=tianpu in .env are unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Du Wenbo
2026-04-06 22:02:38 +08:00
parent 1636dea8f1
commit 60e7f08d7e
15 changed files with 61 additions and 29 deletions

View File

@@ -6,23 +6,23 @@ import yaml
class Settings(BaseSettings):
APP_NAME: str = "TianpuEMS"
APP_NAME: str = "EMS Platform"
DEBUG: bool = True
API_V1_PREFIX: str = "/api/v1"
# Customer configuration
CUSTOMER: str = "tianpu" # tianpu, zpark, etc.
CUSTOMER: str = "default" # tianpu, zpark, etc.
CUSTOMER_DISPLAY_NAME: str = "" # Loaded from customer config
# Database: set DATABASE_URL in .env to override.
# Default: SQLite for local dev. Docker sets PostgreSQL via env var.
# Examples:
# SQLite: sqlite+aiosqlite:///./tianpu_ems.db
# PostgreSQL: postgresql+asyncpg://tianpu:tianpu2026@localhost:5432/tianpu_ems
DATABASE_URL: str = "sqlite+aiosqlite:///./tianpu_ems.db"
# SQLite: sqlite+aiosqlite:///./ems.db
# PostgreSQL: postgresql+asyncpg://ems:ems2026@localhost:5432/ems
DATABASE_URL: str = "sqlite+aiosqlite:///./ems.db"
REDIS_URL: str = "redis://localhost:6379/0"
SECRET_KEY: str = "tianpu-ems-secret-key-change-in-production-2026"
SECRET_KEY: str = "ems-secret-key-change-in-production-2026"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 480
@@ -40,7 +40,7 @@ class Settings(BaseSettings):
SMTP_PORT: int = 587
SMTP_USER: str = ""
SMTP_PASSWORD: str = ""
SMTP_FROM: str = "noreply@tianpu-ems.com"
SMTP_FROM: str = "noreply@ems-platform.com"
SMTP_ENABLED: bool = False
# Platform URL for links in emails