From 70969d43ecf4825c6006c0b8041425def2d745a5 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 2 Oct 2019 22:10:59 -0600 Subject: [PATCH] Support a data path for Docker usage Storing somewhere in the Docker container doesn't help anyone - we should use the volume --- Dockerfile | 2 +- pantalaimon/main.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9898e9d..d5e618e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ RUN pip install . gobject PyGObject "matrix-nio@git+https://github.com/poljar/ma VOLUME /data ENTRYPOINT ["pantalaimon"] -CMD ["-c", "/data/pantalaimon.conf"] +CMD ["-c", "/data/pantalaimon.conf", "--data-path", "/data"] diff --git a/pantalaimon/main.py b/pantalaimon/main.py index a30a708..8917d8d 100644 --- a/pantalaimon/main.py +++ b/pantalaimon/main.py @@ -128,8 +128,9 @@ async def message_router(receive_queue, send_queue, proxies): default=None, ) @click.option("-c", "--config", type=click.Path(exists=True)) +@click.option("--data-path", type=click.Path(exists=True)) @click.pass_context -def main(context, log_level, config): +def main(context, log_level, config, data_path): loop = asyncio.get_event_loop() conf_dir = user_config_dir("pantalaimon", "") @@ -137,6 +138,7 @@ def main(context, log_level, config): create_dirs(data_dir, conf_dir) config = config or os.path.join(conf_dir, "pantalaimon.conf") + data_dir = data_path or data_dir if log_level: log_level = parse_log_level(log_level)