mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-03-28 17:42:45 +01:00
Major documentation update with new data structure: Breaking Changes: - Data storage moved from host directories to ./data/ inside project - MC_CONFIG_DIR default changed: /root/.config/meshcore → ./data/meshcore - MC_ARCHIVE_DIR default changed: /mnt/archive/meshcore → ./data/archive - Requires migration for existing installations (see MIGRATION.md) Documentation: - Add MIGRATION.md - step-by-step guide for existing users - Add FRESH_INSTALL.md - complete installation guide for new users - Update README.md - new Configuration section with ./data/ structure - Update .env.example - placeholders instead of real values, new defaults - Update .claude/CLAUDE.md - updated environment variables documentation - Change serial device detection from 'ls -l' to 'ls' (cleaner output) Code Cleanup: - Remove deprecated MC_REFRESH_INTERVAL variable (unused since intelligent refresh) - Remove MC_REFRESH_INTERVAL from app/config.py - Remove refresh_interval from app/routes/views.py (5 functions) - Remove refresh_interval from app/routes/api.py - Remove refreshInterval from app/templates/index.html - Remove refreshInterval from app/templates/dm.html - Remove MC_REFRESH_INTERVAL from docker-compose.yml Configuration: - Update .gitignore - exclude data/ and docs/github-discussion-*.md - Serial port: use /dev/serial/by-id/[YOUR_DEVICE_ID] placeholder - Device name: use [YOUR_DEVICE_NAME] placeholder Benefits: - All project data in one location (easier backups) - Better portability (no host dependencies) - Cleaner codebase (removed unused variables) - Comprehensive documentation for migration and fresh install 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""
|
|
Configuration module - loads settings from environment variables
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
class Config:
|
|
"""Application configuration from environment variables"""
|
|
|
|
# MeshCore device configuration
|
|
MC_SERIAL_PORT = os.getenv('MC_SERIAL_PORT', '/dev/ttyUSB0')
|
|
MC_DEVICE_NAME = os.getenv('MC_DEVICE_NAME', 'MeshCore')
|
|
MC_CONFIG_DIR = os.getenv('MC_CONFIG_DIR', '/root/.config/meshcore')
|
|
|
|
# MeshCore Bridge configuration
|
|
MC_BRIDGE_URL = os.getenv('MC_BRIDGE_URL', 'http://meshcore-bridge:5001/cli')
|
|
|
|
# Application settings
|
|
MC_INACTIVE_HOURS = int(os.getenv('MC_INACTIVE_HOURS', '48'))
|
|
|
|
# Archive configuration
|
|
MC_ARCHIVE_DIR = os.getenv('MC_ARCHIVE_DIR', '/root/.archive/meshcore')
|
|
MC_ARCHIVE_ENABLED = os.getenv('MC_ARCHIVE_ENABLED', 'true').lower() == 'true'
|
|
MC_ARCHIVE_RETENTION_DAYS = int(os.getenv('MC_ARCHIVE_RETENTION_DAYS', '7'))
|
|
|
|
# Flask server configuration
|
|
FLASK_HOST = os.getenv('FLASK_HOST', '0.0.0.0')
|
|
FLASK_PORT = int(os.getenv('FLASK_PORT', '5000'))
|
|
FLASK_DEBUG = os.getenv('FLASK_DEBUG', 'false').lower() == 'true'
|
|
|
|
# Derived paths
|
|
@property
|
|
def msgs_file_path(self) -> Path:
|
|
"""Get the full path to the .msgs file"""
|
|
return Path(self.MC_CONFIG_DIR) / f"{self.MC_DEVICE_NAME}.msgs"
|
|
|
|
@property
|
|
def archive_dir_path(self) -> Path:
|
|
"""Get the full path to archive directory"""
|
|
return Path(self.MC_ARCHIVE_DIR)
|
|
|
|
def __repr__(self):
|
|
return (
|
|
f"Config(device={self.MC_DEVICE_NAME}, "
|
|
f"port={self.MC_SERIAL_PORT}, "
|
|
f"config_dir={self.MC_CONFIG_DIR})"
|
|
)
|
|
|
|
|
|
# Global config instance
|
|
config = Config()
|