Skip to content

Commit

Permalink
feat: return code 3 when restart is required
Browse files Browse the repository at this point in the history
  • Loading branch information
aleneum committed Dec 11, 2024
1 parent 384fdd1 commit 1abd867
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hive_cli/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import logging.handlers
import os
import sys

import uvicorn
from fastapi import FastAPI
Expand All @@ -19,6 +20,7 @@
# - show fingerprint and reload setup page
# - show password once!


def setup_logging() -> None:
logging.basicConfig(level=logging.WARNING)
settings = load_settings()
Expand Down Expand Up @@ -62,3 +64,9 @@ def prod() -> None:
ssl_keyfile_password=settings.server.ssl.passphrase,
timeout_graceful_shutdown=1,
)
_LOGGER.info("Shutting down.")
if (settings.hive_repo.parent / "_restart").exists():
(settings.hive_repo.parent / "_restart").unlink()
_LOGGER.info("Restarting hive-cli requested.")
sys.exit(3)
sys.exit(0)

0 comments on commit 1abd867

Please sign in to comment.