From 54b431c70c620e6f389eac6fc4a44f4b3eafa510 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Mon, 6 Jan 2020 09:36:51 +0100
Subject: [PATCH] Merge .env files and add docker configurations for the
nopaqued service.
---
.gitignore | 3 +--
db.env.tpl | 3 ---
docker-compose.yml | 10 +++-------
docker-entrypoint.sh | 6 ++----
nopaque.env.tpl | 24 ++++++++++++++++++++++++
web.env.tpl | 14 --------------
6 files changed, 30 insertions(+), 30 deletions(-)
delete mode 100644 db.env.tpl
create mode 100644 nopaque.env.tpl
delete mode 100644 web.env.tpl
diff --git a/.gitignore b/.gitignore
index b58d9913..7e4e218c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
# Files
-db.env
-web.env
+*.env
# Directories
diff --git a/db.env.tpl b/db.env.tpl
deleted file mode 100644
index 5ad5b2b6..00000000
--- a/db.env.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-POSTGRES_DB_NAME=opaque
-POSTGRES_USER=opaque
-POSTGRES_PASSWORD=opaque
diff --git a/docker-compose.yml b/docker-compose.yml
index 2290f493..1aad46ca 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -7,9 +7,7 @@ services:
depends_on:
- db
- redis
- env_file:
- - db.env
- - web.env
+ env_file: nopaque.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque:development
volumes:
- /mnt/nopaque:/mnt/nopaque
@@ -24,9 +22,7 @@ services:
daemon:
depends_on:
- db
- env_file:
- - db.env
- - web.env
+ env_file: nopaque.env
extra_hosts:
- "host.docker.internal:172.17.0.1"
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
@@ -39,7 +35,7 @@ services:
- ../opaque_daemon/requirements.txt:/home/nopaqued/requirements.txt
- $HOME/.docker:/home/nopaqued/.docker
db:
- env_file: db.env
+ env_file: nopaque.env
image: postgres:11
volumes:
- /srv/nopaque/database:/var/lib/postgresql/data
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index dd7c6d6f..3b334c1b 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -5,11 +5,9 @@ wait-for-it db:5432 --strict --timeout=0
echo "Waiting for redis..."
wait-for-it redis:6379 --strict --timeout=0
-if [ $# -eq 0 ]
-then
+if [ $# -eq 0 ]; then
venv/bin/python -u nopaque.py
-elif [ $1 == "flask" ]
-then
+elif [ $1 == "flask" ]; then
echo "$@"
venv/bin/python -m $@
else
diff --git a/nopaque.env.tpl b/nopaque.env.tpl
new file mode 100644
index 00000000..2f2cd28d
--- /dev/null
+++ b/nopaque.env.tpl
@@ -0,0 +1,24 @@
+### Database ###
+POSTGRES_DB_NAME=
+POSTGRES_USER=
+POSTGRES_PASSWORD=
+
+### Docker ###
+DOCKER_CERT_PATH=
+DOCKER_HOST=
+DOCKER_TLS_VERIFY=
+
+### Flask ###
+FLASK_CONFIG=
+# SECRET_KEY=
+
+### Flask-Mail ###
+MAIL_SERVER=
+MAIL_PORT=
+MAIL_USE_TLS=
+MAIL_USERNAME=
+MAIL_PASSWORD=
+MAIL_DEFAULT_SENDER=
+
+### nopaque ###
+NOPAQUE_ADMIN=
diff --git a/web.env.tpl b/web.env.tpl
deleted file mode 100644
index 09209c7e..00000000
--- a/web.env.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-### Flask ###
-FLASK_CONFIG=production
-# SECRET_KEY=
-
-### Flask-Mail ###
-MAIL_SERVER=smtp.example.com
-MAIL_PORT=587
-MAIL_USE_TLS=true
-MAIL_USERNAME=username@example.com
-MAIL_PASSWORD=password
-MAIL_DEFAULT_SENDER=username@example.com
-
-### nopaque ###
-NOPAQUE_ADMIN=admin.opaque@example.com