You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
858 B
Python
44 lines
858 B
Python
import argparse
|
|
import asyncio
|
|
|
|
from .config import load_config
|
|
from .bot import send_messages
|
|
from .format import format_alerts
|
|
from .webhook import run_webhook
|
|
|
|
async def __main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("-c", "--config", default="config.yaml")
|
|
args = parser.parse_args()
|
|
|
|
config = load_config(args.config)
|
|
alert_queue = asyncio.Queue()
|
|
message_queue = asyncio.Queue()
|
|
|
|
bot_corout = send_messages(
|
|
message_queue,
|
|
config
|
|
)
|
|
format_corout = format_alerts(
|
|
alert_queue,
|
|
message_queue,
|
|
config
|
|
)
|
|
webhook_corout = run_webhook(
|
|
alert_queue,
|
|
config
|
|
)
|
|
|
|
|
|
await asyncio.gather(
|
|
bot_corout,
|
|
format_corout,
|
|
webhook_corout
|
|
)
|
|
|
|
def main():
|
|
asyncio.run(__main())
|
|
|
|
if __name__ == "__main__":
|
|
main()
|