From 2ead38bbe4ffa74a95f163a5c45447aaf927af26 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 12 Oct 2022 15:32:47 +0200
Subject: [PATCH] Add new config option. DOCKER_NETWORK_NAME
---
app/daemon/corpus_utils.py | 2 +-
config.py | 3 +++
docker-compose.yml | 4 ++++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/daemon/corpus_utils.py b/app/daemon/corpus_utils.py
index 1703521a..4d807c14 100644
--- a/app/daemon/corpus_utils.py
+++ b/app/daemon/corpus_utils.py
@@ -143,7 +143,7 @@ def _create_cqpserver_container(corpus):
''' ## Name ## '''
name = f'cqpserver_{corpus.id}'
''' ## Network ## '''
- network = 'nopaque_default'
+ network = f'{current_app.config["DOCKER_NETWORK_NAME"]}'
''' ## Volumes ## '''
volumes = []
''' ### Corpus data volume ### '''
diff --git a/config.py b/config.py
index 4eba99d2..97e810ee 100644
--- a/config.py
+++ b/config.py
@@ -11,6 +11,9 @@ load_dotenv(os.path.join(basedir, '.env'))
class Config:
+ ''' Docker '''
+ DOCKER_NETWORK_NAME = os.environ.get('DOCKER_NETWORK_NAME', 'nopaque_default')
+
''' APIFairy '''
APIFAIRY_TITLE = 'nopaque'
APIFAIRY_VERSION = '0.0.1'
diff --git a/docker-compose.yml b/docker-compose.yml
index f668e00d..52f011e6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,9 @@
version: "3.5"
+networks:
+ default:
+ name: "${DOCKER_NETWORK_NAME:-nopaque_default}"
+
services:
db:
env_file: db.env