Whyyy docker-specific behavior
This commit is contained in:
parent
88bcd0fcf1
commit
6522c72b54
4 changed files with 4 additions and 12 deletions
|
@ -15,8 +15,8 @@ ENV DOCKER_RUNNING=true
|
||||||
|
|
||||||
### App specific crap
|
### App specific crap
|
||||||
# Deps vary least so do them first
|
# 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"]
|
CMD ["python3", "relay/__main__.py", "-c", "relay.yaml", "run"]
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import Crypto
|
|
||||||
import click
|
import click
|
||||||
from relay import __version__, misc
|
from relay import __version__, misc
|
||||||
from relay.application import (
|
from relay.application import (
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Application(web.Application):
|
||||||
self["starttime"] = None
|
self["starttime"] = None
|
||||||
self["running"] = False
|
self["running"] = False
|
||||||
self["is_docker"] = bool(os.environ.get("DOCKER_RUNNING"))
|
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():
|
if not self["config"].load():
|
||||||
self["config"].save()
|
self["config"].save()
|
||||||
|
|
|
@ -24,20 +24,14 @@ class RelayConfig(DotDict):
|
||||||
|
|
||||||
cachekeys = {"json", "objects", "digests"}
|
cachekeys = {"json", "objects", "digests"}
|
||||||
|
|
||||||
def __init__(self, path, is_docker):
|
def __init__(self, path):
|
||||||
DotDict.__init__(self, {})
|
DotDict.__init__(self, {})
|
||||||
|
|
||||||
if is_docker:
|
|
||||||
path = "/data/relay.yaml"
|
|
||||||
|
|
||||||
self._isdocker = is_docker
|
|
||||||
self._path = Path(path).expanduser()
|
self._path = Path(path).expanduser()
|
||||||
|
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
if self._isdocker and key in ["db", "listen", "port"]:
|
|
||||||
return
|
|
||||||
|
|
||||||
if key in ["blocked_instances", "blocked_software", "whitelist"]:
|
if key in ["blocked_instances", "blocked_software", "whitelist"]:
|
||||||
assert isinstance(value, (list, set, tuple))
|
assert isinstance(value, (list, set, tuple))
|
||||||
|
|
Loading…
Reference in a new issue