argh/node.py

31 lines
673 B
Python
Raw Normal View History

2025-09-27 07:36:55 +02:00
#!/usr/bin/env python3
2025-09-27 07:51:50 +02:00
# Copyright (c) 2025 Julian Müller (ChaoticByte)
2025-09-27 07:36:55 +02:00
import asyncio
import signal
2025-09-27 07:36:55 +02:00
from argparse import ArgumentParser
from pathlib import Path
from argh.log import log
2025-09-27 07:51:50 +02:00
from argh.node import node_from_yml
2025-09-27 07:36:55 +02:00
if __name__ == "__main__":
argp = ArgumentParser()
argp.add_argument("config", type=Path, help="Path to the config yaml file")
args = argp.parse_args()
node = node_from_yml(args.config.read_text())
def _sigint(*args):
# don't need special sigint behaviour
# -> send SIGTERM
signal.raise_signal(signal.SIGTERM)
signal.signal(signal.SIGINT, _sigint)
2025-09-27 07:36:55 +02:00
asyncio.run(node.run())
log("Bye")