b99450db2f
Mirror the Proxmox auto-sync pattern for the Zigbee2MQTT and Z-Wave JS UI mesh imports. Connection config + MQTT credentials live in .env only, are never persisted to scan_config.json, and are never returned by any API or shown in the UI (single source of truth). - config: ZIGBEE_* / ZWAVE_* env settings; only sync_enabled+interval are persisted, connection/credentials stay env-only - routes: GET/POST /config, POST /sync-now; auto-sync reuses the exact manual _background_*_import + _persist_pending_import path (fresh import when empty, update-in-place when nodes exist, ScanRun trace) - scheduler: zigbee_sync / zwave_sync jobs with live enable + reschedule - frontend: reusable MeshAutoSync section in Settings (Zigbee, Z-Wave) - .env.example: documented both blocks - tests: scheduler jobs, router config/sync-now/auth, credential-never- persisted, SettingsModal sections Manual Zigbee/Z-Wave import behaviour is unchanged. ha-relevant: no
88 lines
4.4 KiB
Bash
88 lines
4.4 KiB
Bash
# Backend - server-side only (NEVER commit .env)
|
||
SECRET_KEY=change_me_in_production
|
||
SQLITE_PATH=./data/homelab.db
|
||
# Uploaded media (floor plans) folder. Optional — defaults to <SQLITE_PATH dir>/uploads,
|
||
# which sits on the same persistent volume as the DB.
|
||
# UPLOAD_DIR=./data/uploads
|
||
# Set this to the URL(s) you use to access Homelable in your browser.
|
||
CORS_ORIGINS=["http://localhost:5173","http://localhost:3000"]
|
||
|
||
# Auth — default credentials: admin / admin
|
||
# ⚠️ Change before exposing on a network.
|
||
# Generate a new hash: python3 -c "from passlib.context import CryptContext; print(CryptContext(schemes=['bcrypt']).hash('yourpassword'))"
|
||
# ⚠️ Keep the single quotes around the hash — bcrypt hashes contain \$ which Docker misinterprets without them.
|
||
AUTH_USERNAME=admin
|
||
AUTH_PASSWORD_HASH='$2b$12$RtMbyw17l4N5UGzeXMNAWuzCaVV.XFBY7ZetWheQhxcBDcxahapkG'
|
||
|
||
# Scanner — JSON array of CIDR ranges to scan
|
||
SCANNER_RANGES=["192.168.1.0/24"]
|
||
|
||
# Deep scan (optional) — extra nmap port ranges + HTTP probe for service ID on
|
||
# custom ports. Defaults below are overridable per-scan from the scan dialog.
|
||
# SCANNER_HTTP_RANGES: JSON array of port specs, each a single port "N" or an
|
||
# inclusive range "N-M" (1–65535, N <= M). Not CIDRs, not bare ints.
|
||
# Example: SCANNER_HTTP_RANGES=["8080","9000-9100"]
|
||
SCANNER_HTTP_RANGES=[]
|
||
SCANNER_HTTP_PROBE_ENABLED=false
|
||
SCANNER_HTTP_VERIFY_TLS=false
|
||
|
||
# Status checker interval in seconds
|
||
STATUS_CHECKER_INTERVAL=60
|
||
|
||
# MCP server — used by the mcp service (port 8001)
|
||
# MCP_API_KEY: authenticates AI clients (Claude Code, etc.) → MCP server
|
||
# MCP_SERVICE_KEY: authenticates MCP server → backend (never exposed externally)
|
||
# Generate keys: python3 -c "import secrets; print(secrets.token_hex(32))"
|
||
MCP_API_KEY=mcp_sk_changeme
|
||
MCP_SERVICE_KEY=svc_changeme
|
||
|
||
# Live view — read-only public canvas at /view?key=<value>
|
||
# Off by default. Set to a random secret to enable.
|
||
# Generate: python3 -c "import secrets; print(secrets.token_urlsafe(32))"
|
||
# LIVEVIEW_KEY=
|
||
|
||
# Gethomepage widget — read-only stats at /api/v1/stats/summary
|
||
# Off by default. Set to a random secret to enable; clients must send
|
||
# the same value in the `X-API-Key` header.
|
||
# Generate: python3 -c "import secrets; print(secrets.token_urlsafe(32))"
|
||
# HOMEPAGE_API_KEY=
|
||
|
||
# Proxmox VE import — pull hosts/VMs/LXC from the Proxmox REST API.
|
||
# The token is a credential: kept in memory only, never written to disk by the
|
||
# app, never returned by any API. Create it under Datacenter → Permissions →
|
||
# API Tokens and grant the read-only PVEAuditor role at path "/".
|
||
# Token id format: user@realm!tokenname (e.g. root@pam!homelable).
|
||
# Required only for auto-sync; one-off imports can pass the token in the dialog.
|
||
# PROXMOX_TOKEN_ID=root@pam!homelable
|
||
# PROXMOX_TOKEN_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||
# PROXMOX_HOST=192.168.1.10
|
||
# PROXMOX_PORT=8006
|
||
# PROXMOX_VERIFY_TLS=true # set false only for self-signed certs
|
||
|
||
# Zigbee2MQTT auto-sync — pull the mesh from an MQTT broker on a schedule.
|
||
# MQTT credentials are secrets: kept in memory only, never written to disk by
|
||
# the app, never returned by any API. Manual imports (the Zigbee dialog) are
|
||
# unaffected — this block only powers Settings → Zigbee auto-sync and /sync-now.
|
||
# Required only for auto-sync; one-off imports pass their config in the dialog.
|
||
# ZIGBEE_MQTT_HOST=192.168.1.20
|
||
# ZIGBEE_MQTT_PORT=1883
|
||
# ZIGBEE_MQTT_USERNAME=mqttuser # optional
|
||
# ZIGBEE_MQTT_PASSWORD=mqttpass # optional
|
||
# ZIGBEE_BASE_TOPIC=zigbee2mqtt
|
||
# ZIGBEE_MQTT_TLS=false # true for TLS brokers (typically port 8883)
|
||
# ZIGBEE_MQTT_TLS_INSECURE=false # skip cert verify (self-signed only; requires TLS)
|
||
# ZIGBEE_SYNC_ENABLED=false # turn scheduled auto-sync on
|
||
# ZIGBEE_SYNC_INTERVAL=3600 # seconds between syncs (min 300)
|
||
|
||
# Z-Wave JS UI (zwavejs2mqtt) auto-sync — same MQTT secret/env rules as Zigbee.
|
||
# ZWAVE_MQTT_HOST=192.168.1.20
|
||
# ZWAVE_MQTT_PORT=1883
|
||
# ZWAVE_MQTT_USERNAME=mqttuser # optional
|
||
# ZWAVE_MQTT_PASSWORD=mqttpass # optional
|
||
# ZWAVE_PREFIX=zwave
|
||
# ZWAVE_GATEWAY_NAME=zwavejs2mqtt
|
||
# ZWAVE_MQTT_TLS=false # true for TLS brokers (typically port 8883)
|
||
# ZWAVE_MQTT_TLS_INSECURE=false # skip cert verify (self-signed only; requires TLS)
|
||
# ZWAVE_SYNC_ENABLED=false # turn scheduled auto-sync on
|
||
# ZWAVE_SYNC_INTERVAL=3600 # seconds between syncs (min 300)
|