Files
nvcurve/nvcurve/config.py
T
ARIA d9260007d1 fix: fan settings persistence, profile indicator, and point removal
Address three fan-settings issues:

1. Profile view: show a fan icon next to a profile's name when it has a
   saved fan curve, so it's clear which profiles carry custom fans.

2. Fan curve persistence: the active fan curve was in-memory only and lost
   on every server restart. It is now persisted per-GPU in
   /etc/nvcurve/config.json (fan_curves) and re-applied at server startup,
   so an applied curve survives restarts. All fan-curve state changes route
   through _activate_fan_curve/_deactivate_fan_curve helpers that keep the
   persisted state in sync (apply, reset, and profile apply).

3. Point removal: the fan-curve remove button was nearly invisible. The
   chart remove control is now always faintly visible with an X glyph, the
   table remove button is larger with a tooltip, and a hint line explains
   how to add/remove points.

Also includes a formatting pass over the two edited frontend files.
2026-09-02 17:25:09 +02:00

43 lines
1.6 KiB
Python

"""User-configurable settings with sensible defaults."""
from dataclasses import dataclass, field
@dataclass
class Config:
# Safety limits
max_delta_khz: int = 3000_000 # ±3000 MHz hard cap
auto_snapshot: bool = True # Save snapshot before every write
max_snapshots: int = 20 # Maximum snapshots to keep (0 = unlimited)
# Monitoring
poll_interval_s: float = 1.0 # WebSocket monitor poll rate
# API server
host: str = "127.0.0.1"
port: int = 8042
snapshot_dir: str = "/var/cache/nvcurve/snapshots"
profile_dir: str = "/etc/nvcurve/profiles"
# Authentication: path to the bcrypt user store. If the file exists and
# contains at least one user, the API requires login (dual mode). If it is
# absent or empty, the server runs with no authentication.
users_file: str = "/etc/nvcurve/users.json"
# Per-GPU default profiles: applied automatically on server startup.
# Key = stable GPU identifier (UUID string, "pci:{bus_id}", or "idx:{n}" fallback).
# Value = profile name (str).
auto_load_profiles: dict[str, str] = field(default_factory=dict)
# Per-GPU active fan curves: restored automatically on server startup so a
# curve applied via the UI survives server restarts (fan control itself is
# volatile — the driver reverts to automatic mode on reboot).
# Key = stable GPU identifier (same as auto_load_profiles).
# Value = list of {"temp_c": int, "fan_pct": int} sorted by temp_c.
fan_curves: dict[str, list] = field(default_factory=dict)
# Module-level default config instance.
default_config = Config()