From c9455005891c8c5d058bba940e1f0e789de7db63 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sat, 26 Nov 2022 15:46:42 -0700 Subject: [PATCH] Whyyy docker-specific behavior --- projects/activitypub_relay/Dockerfile | 4 ++-- projects/activitypub_relay/src/python/relay/__main__.py | 2 -- .../activitypub_relay/src/python/relay/application.py | 2 +- projects/activitypub_relay/src/python/relay/config.py | 8 +------- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/projects/activitypub_relay/Dockerfile b/projects/activitypub_relay/Dockerfile index 4db513e..ceeb650 100644 --- a/projects/activitypub_relay/Dockerfile +++ b/projects/activitypub_relay/Dockerfile @@ -15,8 +15,8 @@ ENV DOCKER_RUNNING=true ### App specific crap # Deps vary least so do them first -RUN pip install --user install aiohttp aiohttp_basicauth async_lru cachetools click pycryptodome pyyaml retry +RUN pip3 install --user install aiohttp aiohttp_basicauth async_lru cachetools click pycryptodome pyyaml retry -COPY --chown=app:app src/python relay.yaml relay.jsonld . +COPY --chown=app:app src/python relay.yaml relay.jsonld /app/ CMD ["python3", "relay/__main__.py", "-c", "relay.yaml", "run"] diff --git a/projects/activitypub_relay/src/python/relay/__main__.py b/projects/activitypub_relay/src/python/relay/__main__.py index b5c2998..a37c30a 100644 --- a/projects/activitypub_relay/src/python/relay/__main__.py +++ b/projects/activitypub_relay/src/python/relay/__main__.py @@ -1,10 +1,8 @@ import asyncio import logging import os -import platform from urllib.parse import urlparse -import Crypto import click from relay import __version__, misc from relay.application import ( diff --git a/projects/activitypub_relay/src/python/relay/application.py b/projects/activitypub_relay/src/python/relay/application.py index 5085df9..e3cb62c 100644 --- a/projects/activitypub_relay/src/python/relay/application.py +++ b/projects/activitypub_relay/src/python/relay/application.py @@ -24,7 +24,7 @@ class Application(web.Application): self["starttime"] = None self["running"] = False self["is_docker"] = bool(os.environ.get("DOCKER_RUNNING")) - self["config"] = RelayConfig(cfgpath, self["is_docker"]) + self["config"] = RelayConfig(cfgpath) if not self["config"].load(): self["config"].save() diff --git a/projects/activitypub_relay/src/python/relay/config.py b/projects/activitypub_relay/src/python/relay/config.py index 7726589..e53785c 100644 --- a/projects/activitypub_relay/src/python/relay/config.py +++ b/projects/activitypub_relay/src/python/relay/config.py @@ -24,20 +24,14 @@ class RelayConfig(DotDict): cachekeys = {"json", "objects", "digests"} - def __init__(self, path, is_docker): + def __init__(self, path): DotDict.__init__(self, {}) - if is_docker: - path = "/data/relay.yaml" - - self._isdocker = is_docker self._path = Path(path).expanduser() self.reset() def __setitem__(self, key, value): - if self._isdocker and key in ["db", "listen", "port"]: - return if key in ["blocked_instances", "blocked_software", "whitelist"]: assert isinstance(value, (list, set, tuple))