Replaces LICENSE (GPLv3 -> AGPLv3) and prepends `SPDX-License-Identifier: AGPL-3.0-or-later` to every source file across decnet/, decnet_web/, tests/, scripts/, and tools/. Rationale: closes the GPLv3 ASP loophole so any party operating a modified DECNET as a network service must offer their modified source. Personal copyright (Samuel Paschuan) + inbound=outbound contributions make a future unilateral relicense infeasible. - LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt) - COPYRIGHT: project copyright notice - tools/add_spdx_headers.py: idempotent header injector (shebang- and PEP 263-aware) Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh). No behavior change; comments only.
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
from __future__ import annotations
|
|
|
|
import typer
|
|
|
|
from . import utils as _utils
|
|
from .utils import console, log
|
|
|
|
|
|
def register(app: typer.Typer) -> None:
|
|
@app.command(name="bus")
|
|
def bus_cmd(
|
|
socket_path: str = typer.Option(
|
|
None, "--socket", "-s",
|
|
help="UNIX socket path (defaults to DECNET_BUS_SOCKET env var, "
|
|
"then /run/decnet/bus.sock, then ~/.decnet/bus.sock).",
|
|
),
|
|
group: str = typer.Option(
|
|
"decnet", "--group", "-g",
|
|
help="POSIX group to chown the socket to (falls back to process "
|
|
"group if the named group does not exist).",
|
|
),
|
|
heartbeat: int = typer.Option(
|
|
10, "--heartbeat", "-H",
|
|
help="Seconds between system.bus.health heartbeat events.",
|
|
),
|
|
daemon: bool = typer.Option(False, "--daemon", "-d", help="Detach to background as a daemon process."),
|
|
) -> None:
|
|
"""Run the DECNET ServiceBus worker (host-local UNIX-socket pub/sub)."""
|
|
import asyncio
|
|
from decnet.bus.factory import _default_socket_path
|
|
from decnet.bus.worker import bus_worker
|
|
|
|
resolved = socket_path or _default_socket_path()
|
|
|
|
if daemon:
|
|
log.info("bus daemonizing socket=%s", resolved)
|
|
_utils._daemonize()
|
|
|
|
log.info("bus starting socket=%s group=%s heartbeat=%ds", resolved, group, heartbeat)
|
|
console.print(f"[bold cyan]Bus starting[/] (socket: {resolved}, heartbeat: {heartbeat}s)")
|
|
|
|
try:
|
|
asyncio.run(bus_worker(resolved, group=group, heartbeat_interval=heartbeat))
|
|
except KeyboardInterrupt:
|
|
console.print("\n[yellow]Bus stopped.[/]")
|