Skip to content
Snippets Groups Projects
__init__.py 1022 B
Newer Older
"""The main entrypoint for :term:`GSO`, and the different ways in which it can be run."""

import typer
Mohammad Torkashvand's avatar
Mohammad Torkashvand committed
from orchestrator import OrchestratorCore, app_settings
# noinspection PyUnresolvedReferences
import gso.workflows  # noqa: F401
from gso.api import router as api_router
from gso.cli import imports
from orchestrator.cli.main import app as cli_app

def init_gso_app() -> OrchestratorCore:
    """Initialise the :term:`GSO` app."""
Mohammad Torkashvand's avatar
Mohammad Torkashvand committed
    app = OrchestratorCore(base_settings=app_settings)
    app.include_router(api_router, prefix="/api")
    return app


def init_worker_app() -> OrchestratorCore:
    """Initialise a :term:`GSO` instance as Celery worker."""
Mohammad Torkashvand's avatar
Mohammad Torkashvand committed
    return OrchestratorCore(base_settings=app_settings)


def init_cli_app() -> typer.Typer:
    """Initialise :term:`GSO` as a CLI application."""
    from gso.cli import import_sites, netbox  # noqa: PLC0415
    cli_app.add_typer(imports.app, name="import-cli")
    cli_app.add_typer(netbox.app, name="netbox-cli")
    return cli_app()