fix apply config event
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import os
|
||||
import logging
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
from database import get_db
|
||||
from utils.auth import verify_token
|
||||
from services import generator
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(dependencies=[Depends(verify_token)])
|
||||
|
||||
@router.post("/server/configure")
|
||||
|
||||
@@ -200,6 +200,17 @@ def get_process_stats():
|
||||
"uptime": None
|
||||
}
|
||||
|
||||
def get_os_type() -> str:
|
||||
"""
|
||||
Detects the host OS type to determine which service manager to use.
|
||||
Currently supports: 'alpine', 'debian' (fallback for systemd systems).
|
||||
"""
|
||||
if os.path.exists("/etc/alpine-release"):
|
||||
return "alpine"
|
||||
|
||||
# Fallback to debian/ubuntu (systemd)
|
||||
return "debian"
|
||||
|
||||
def format_seconds(seconds: float) -> str:
|
||||
seconds = int(seconds)
|
||||
days, seconds = divmod(seconds, 86400)
|
||||
|
||||
Reference in New Issue
Block a user