From e1498a8d6ed2083cf94e8dbbadfbdbb5b64d9375 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 15 Oct 2021 08:17:10 -0400 Subject: [PATCH] add parameter for config location --- relay/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/relay/__init__.py b/relay/__init__.py index 3785de6..d4e39f8 100644 --- a/relay/__init__.py +++ b/relay/__init__.py @@ -5,10 +5,17 @@ import asyncio import aiohttp import aiohttp.web import yaml +import argparse +parser = argparse.ArgumentParser( + description="A generic LitePub relay (works with all LitePub consumers and Mastodon).", + prog="python -m relay") +parser.add_argument("-c", "--config", type=str, default="relay.yaml", + metavar="", help="the path to your config file") +args = parser.parse_args() def load_config(): - with open('relay.yaml') as f: + with open(args.config) as f: options = {} ## Prevent a warning message for pyyaml 5.1+