Compare commits

..

5 commits

Author SHA1 Message Date
Izalia Mae aa8090eebb don't prompt for ignored settings in docker instances 2022-12-08 03:31:47 -05:00
Izalia Mae f287b84ea3 update aputils 2022-12-07 23:23:13 -05:00
Izalia Mae dc74bfb588 force certain config values in docker installs 2022-12-07 23:16:48 -05:00
Izalia Mae e281a06e7f correctly call aputils.Signer.new 2022-12-07 23:15:54 -05:00
Izalia Mae 8f16cab048 prevent errors in post and fetch_nodeinfo 2022-12-07 23:15:31 -05:00
5 changed files with 19 additions and 7 deletions

View file

@ -26,6 +26,13 @@ class Application(web.Application):
if not self['config'].load(): if not self['config'].load():
self['config'].save() self['config'].save()
if self.config.is_docker:
self.config.update({
'db': '/data/relay.jsonld',
'listen': '0.0.0.0',
'port': 8080
})
self['workers'] = [] self['workers'] = []
self['last_worker'] = 0 self['last_worker'] = 0

View file

@ -76,7 +76,7 @@ class RelayDatabase(dict):
if not self['private-key']: if not self['private-key']:
logging.info("No actor keys present, generating 4096-bit RSA keypair.") logging.info("No actor keys present, generating 4096-bit RSA keypair.")
self.signer = aputils.Signer.new(self.config.keyid, 4096) self.signer = aputils.Signer.new(self.config.keyid, size=4096)
self['private-key'] = self.signer.export() self['private-key'] = self.signer.export()
else: else:

View file

@ -159,7 +159,7 @@ class HttpClient:
return logging.verbose(await resp.read()) # change this to debug return logging.verbose(await resp.read()) # change this to debug
except (ClientConnectorError, ServerTimeoutError): except (ClientConnectorError, ServerTimeoutError):
logging.verbose(f'Failed to connect to {url.netloc}') logging.verbose(f'Failed to connect to {url}')
## prevent workers from being brought down ## prevent workers from being brought down
except Exception as e: except Exception as e:
@ -174,6 +174,10 @@ class HttpClient:
loads = WellKnownNodeinfo.new_from_json loads = WellKnownNodeinfo.new_from_json
) )
if not wk_nodeinfo:
logging.verbose(f'Failed to fetch well-known nodeinfo url for domain: {domain}')
return False
for version in ['20', '21']: for version in ['20', '21']:
try: try:
nodeinfo_url = wk_nodeinfo.get_url(version) nodeinfo_url = wk_nodeinfo.get_url(version)

View file

@ -43,6 +43,7 @@ def cli_setup():
click.echo('The domain must not be example.com') click.echo('The domain must not be example.com')
if not app.config.is_docker:
app.config.listen = click.prompt('Which address should the relay listen on?', default=app.config.listen) app.config.listen = click.prompt('Which address should the relay listen on?', default=app.config.listen)
while True: while True:

View file

@ -28,7 +28,7 @@ install_requires =
click >= 8.1.2 click >= 8.1.2
pycryptodome >= 3.14.1 pycryptodome >= 3.14.1
PyYAML >= 5.0.0 PyYAML >= 5.0.0
aputils @ https://git.barkshark.xyz/barkshark/aputils/archive/0.1.2.tar.gz aputils @ git+https://git.barkshark.xyz/barkshark/aputils@2cd1776f12
python_requires = >=3.6 python_requires = >=3.6
[options.extras_require] [options.extras_require]