10 parser = argparse.ArgumentParser(
11 description="A generic LitePub relay (works with all LitePub consumers and Mastodon).",
12 prog="python -m relay")
13 parser.add_argument("-c", "--config", type=str, default="relay.yaml",
14 metavar="<path>", help="the path to your config file")
15 args = parser.parse_args()
18 with open(args.config) as f:
21 ## Prevent a warning message for pyyaml 5.1+
22 if getattr(yaml, 'FullLoader', None):
23 options['Loader'] = yaml.FullLoader
25 yaml_file = yaml.load(f, **options)
28 'db': yaml_file.get('db', 'relay.jsonld'),
29 'listen': yaml_file.get('listen', '0.0.0.0'),
30 'port': int(yaml_file.get('port', 8080)),
31 'note': yaml_file.get('note', 'Make a note about your instance here.'),
33 'blocked_software': [v.lower() for v in yaml_file['ap'].get('blocked_software', [])],
34 'blocked_instances': yaml_file['ap'].get('blocked_instances', []),
35 'host': yaml_file['ap'].get('host', 'localhost'),
36 'whitelist': yaml_file['ap'].get('whitelist', []),
37 'whitelist_enabled': yaml_file['ap'].get('whitelist_enabled', False)
43 CONFIG = load_config()
45 from .http_signatures import http_signatures_middleware
48 app = aiohttp.web.Application(middlewares=[
49 http_signatures_middleware
53 from . import database
55 from . import webfinger
57 from . import nodeinfo
58 from . import http_stats