Refactor frontend views
All checks were successful
Build and push image / build-containers (push) Successful in 10m14s
All checks were successful
Build and push image / build-containers (push) Successful in 10m14s
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
"""CLI and main entry point."""
|
||||
|
||||
import code
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Literal, cast
|
||||
@ -24,6 +25,17 @@ from .models import (
|
||||
)
|
||||
from .settings import BackendSettings
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
formatter = logging.Formatter(
|
||||
"%(asctime)s [%(processName)s: %(process)d] [%(threadName)s: %(thread)d] [%(levelname)s] %(name)s: %(message)s"
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
LOG = logging.getLogger()
|
||||
LOG.addHandler(handler)
|
||||
|
||||
LOG.setLevel(logging.INFO)
|
||||
|
||||
DEFAULT_LISTEN = "127.0.0.1"
|
||||
DEFAULT_PORT = 8022
|
||||
|
||||
@ -32,6 +44,7 @@ WORKDIR = Path(os.getcwd())
|
||||
load_dotenv()
|
||||
|
||||
|
||||
|
||||
def generate_token(
|
||||
settings: BackendSettings, subsystem: Literal["admin", "sshd"]
|
||||
) -> str:
|
||||
@ -73,9 +86,12 @@ def add_system_tokens(settings: BackendSettings) -> None:
|
||||
|
||||
@click.group()
|
||||
@click.option("--database", help="Path to the sqlite database file.")
|
||||
@click.option("--debug", is_flag=True)
|
||||
@click.pass_context
|
||||
def cli(ctx: click.Context, database: str) -> None:
|
||||
def cli(ctx: click.Context, database: str, debug: bool) -> None:
|
||||
"""CLI group."""
|
||||
if debug:
|
||||
LOG.setLevel(logging.DEBUG)
|
||||
if database:
|
||||
settings = BackendSettings(database=str(Path(database).absolute()))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user