fix: propagate Settings config changes to service managers and live pages
- PUT /api/config now calls service_manager.update_config() for each service so changes write to the service's own config file, not just cell_config.json - email_manager.get_status() now reads smtp_port/imap_port/domain from its config file (defaults: 587/993/cell.local) and includes them in the response - calendar_manager.get_status() includes configured port (default 5232) - file_manager.get_status() uses configured port from service config - Email.jsx reads imap_port/smtp_port from API status instead of hardcoding - Settings service sections show "port changes require container restart" note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+12
-3
@@ -29,19 +29,27 @@ class CalendarManager(BaseServiceManager):
|
||||
self.safe_makedirs(self.calendar_data_dir)
|
||||
self.safe_makedirs(self.radicale_dir)
|
||||
|
||||
def _get_configured_port(self) -> int:
|
||||
cfg = self.get_config()
|
||||
if isinstance(cfg, dict) and 'error' not in cfg:
|
||||
return cfg.get('port', 5232)
|
||||
return 5232
|
||||
|
||||
def get_status(self) -> Dict[str, Any]:
|
||||
"""Get calendar service status"""
|
||||
try:
|
||||
port = self._get_configured_port()
|
||||
# Check if we're running in Docker environment
|
||||
import os
|
||||
is_docker = os.path.exists('/.dockerenv') or os.environ.get('DOCKER_CONTAINER') == 'true'
|
||||
|
||||
|
||||
if is_docker:
|
||||
# Check if calendar container is actually running
|
||||
container_running = self._check_calendar_container_status()
|
||||
status = {
|
||||
'running': container_running,
|
||||
'status': 'online' if container_running else 'offline',
|
||||
'port': port,
|
||||
'users_count': 0,
|
||||
'calendars_count': 0,
|
||||
'events_count': 0,
|
||||
@@ -53,16 +61,17 @@ class CalendarManager(BaseServiceManager):
|
||||
users = self._load_users()
|
||||
calendars = self._load_calendars()
|
||||
events = self._load_events()
|
||||
|
||||
|
||||
status = {
|
||||
'running': service_running,
|
||||
'status': 'online' if service_running else 'offline',
|
||||
'port': port,
|
||||
'users_count': len(users),
|
||||
'calendars_count': len(calendars),
|
||||
'events_count': len(events),
|
||||
'timestamp': datetime.utcnow().isoformat()
|
||||
}
|
||||
|
||||
|
||||
return status
|
||||
except Exception as e:
|
||||
return self.handle_error(e, "get_status")
|
||||
|
||||
Reference in New Issue
Block a user