- Move board cards from dashboard to top of boards list page - Fix Werkzeug duplicate polling (WERKZEUG_RUN_MAIN guard) - Smart offline polling: fast loop for online boards, slow recheck for offline - Add manual ping endpoint POST /api/boards/<id>/ping - Add spin animation CSS for ping button Layouts module (new): - app/models/layout.py: Layout model (canvas_json, thumbnail_b64) - app/routes/layouts.py: 5 routes (list, create, builder, save, delete) - app/templates/layouts/: list and builder templates - app/static/js/layout_builder.js: full Konva.js builder engine - app/static/vendor/konva/: vendored Konva.js 9 - Structure mode: wall, room, door, window, fence, text shapes - Devices mode: drag relay/input/Sonoff channels onto canvas - Live view mode: click relays/Sonoff to toggle, socket.io state updates - Device selection: click to select, remove individual device, Delete key - Fix door/Arc size persistence across save/reload (outerRadius, scaleX/Y) - Fix Sonoff devices missing from palette (add makeSonoffChip function)
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Application configuration."""
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
class Config:
|
|
SECRET_KEY = os.environ.get("SECRET_KEY", "change-me-in-production")
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get(
|
|
"DATABASE_URL",
|
|
f"sqlite:///{os.path.join(BASE_DIR, 'instance', 'location_mgmt.db')}"
|
|
)
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
# How often (seconds) the fast poller updates ONLINE boards
|
|
BOARD_POLL_INTERVAL = int(os.environ.get("BOARD_POLL_INTERVAL", 10))
|
|
# How often (seconds) offline boards are rechecked to see if they came back
|
|
OFFLINE_RECHECK_INTERVAL = int(os.environ.get("OFFLINE_RECHECK_INTERVAL", 60))
|
|
# Base URL this server is reachable at (boards will POST webhooks here)
|
|
SERVER_BASE_URL = os.environ.get("SERVER_BASE_URL", "http://localhost:5000")
|
|
|
|
|
|
class DevelopmentConfig(Config):
|
|
DEBUG = True
|
|
|
|
|
|
class ProductionConfig(Config):
|
|
DEBUG = False
|
|
|
|
|
|
config_map = {
|
|
"development": DevelopmentConfig,
|
|
"production": ProductionConfig,
|
|
"default": DevelopmentConfig,
|
|
}
|