Support a data path for Docker usage

Storing somewhere in the Docker container doesn't help anyone - we should use the volume
This commit is contained in:
Travis Ralston 2019-10-02 22:10:59 -06:00
parent 176735eeb8
commit 70969d43ec
2 changed files with 4 additions and 2 deletions

View File

@ -15,4 +15,4 @@ RUN pip install . gobject PyGObject "matrix-nio@git+https://github.com/poljar/ma
VOLUME /data VOLUME /data
ENTRYPOINT ["pantalaimon"] ENTRYPOINT ["pantalaimon"]
CMD ["-c", "/data/pantalaimon.conf"] CMD ["-c", "/data/pantalaimon.conf", "--data-path", "/data"]

View File

@ -128,8 +128,9 @@ async def message_router(receive_queue, send_queue, proxies):
default=None, default=None,
) )
@click.option("-c", "--config", type=click.Path(exists=True)) @click.option("-c", "--config", type=click.Path(exists=True))
@click.option("--data-path", type=click.Path(exists=True))
@click.pass_context @click.pass_context
def main(context, log_level, config): def main(context, log_level, config, data_path):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
conf_dir = user_config_dir("pantalaimon", "") conf_dir = user_config_dir("pantalaimon", "")
@ -137,6 +138,7 @@ def main(context, log_level, config):
create_dirs(data_dir, conf_dir) create_dirs(data_dir, conf_dir)
config = config or os.path.join(conf_dir, "pantalaimon.conf") config = config or os.path.join(conf_dir, "pantalaimon.conf")
data_dir = data_path or data_dir
if log_level: if log_level:
log_level = parse_log_level(log_level) log_level = parse_log_level(log_level)