2018-08-10 19:19:38 +00:00
|
|
|
from . import logging
|
|
|
|
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
import aiohttp
|
|
|
|
import aiohttp.web
|
2018-08-10 19:59:46 +00:00
|
|
|
import yaml
|
|
|
|
|
|
|
|
|
|
|
|
def load_config():
|
2018-10-30 01:42:17 +00:00
|
|
|
with open('relay.yaml') as f:
|
2019-09-30 10:45:46 +00:00
|
|
|
yaml_file = yaml.load(f)
|
|
|
|
whitelist = yaml_file['ap'].get('whitelist', [])
|
|
|
|
blocked = yaml_file['ap'].get('blocked_instances', [])
|
|
|
|
|
|
|
|
config = {
|
|
|
|
'db': yaml_file.get('db', 'relay.jsonld'),
|
|
|
|
'listen': yaml_file.get('listen', '0.0.0.0'),
|
|
|
|
'port': int(yaml_file.get('port', 8080)),
|
|
|
|
'note': yaml_file.get('note', 'Make a note about your instance here.'),
|
|
|
|
'ap': {
|
|
|
|
'blocked_instances': [] if blocked is None else blocked,
|
|
|
|
'host': yaml_file['ap'].get('host', 'localhost'),
|
|
|
|
'whitelist': [] if whitelist is None else whitelist,
|
|
|
|
'whitelist_enabled': yaml_file['ap'].get('whitelist_enabled', False)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return config
|
2018-08-10 19:59:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
CONFIG = load_config()
|
2018-08-10 19:19:38 +00:00
|
|
|
|
|
|
|
|
2018-08-10 21:14:22 +00:00
|
|
|
from .http_signatures import http_signatures_middleware
|
|
|
|
|
|
|
|
|
|
|
|
app = aiohttp.web.Application(middlewares=[
|
|
|
|
http_signatures_middleware
|
|
|
|
])
|
2018-08-10 19:19:38 +00:00
|
|
|
|
|
|
|
|
2018-08-10 19:59:46 +00:00
|
|
|
from . import database
|
2018-08-10 19:19:38 +00:00
|
|
|
from . import actor
|
2018-08-10 20:15:02 +00:00
|
|
|
from . import webfinger
|
2018-10-30 22:35:04 +00:00
|
|
|
from . import default
|
2018-11-18 15:05:13 +00:00
|
|
|
from . import nodeinfo
|
2018-11-18 22:03:53 +00:00
|
|
|
from . import http_stats
|