From 0250f10ce16e868c9667603cf6484950ebc2ee1e Mon Sep 17 00:00:00 2001
From: Bastien Abadie <bastien@nextcairn.com>
Date: Wed, 1 Nov 2017 19:13:27 +0100
Subject: [PATCH] Docker: add dev backend

---
 requirements.txt      | 13 +------------
 src/horae/settings.py | 14 ++++++++------
 2 files changed, 9 insertions(+), 18 deletions(-)
 mode change 100644 => 120000 requirements.txt

diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 7729bf9996..0000000000
--- a/requirements.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-certifi==2017.7.27.1
-chardet==3.0.4
-Django==1.11.6
-djangorestframework==3.7.1
-elasticsearch==5.4.0
-idna==2.6
-olefile==0.44
-Pillow==4.3.0
-psycopg2==2.7.3.2
-pytz==2017.2
-requests==2.18.4
-urllib3==1.22
diff --git a/requirements.txt b/requirements.txt
new file mode 120000
index 0000000000..8166b7c444
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+docker/backend/requirements.txt
\ No newline at end of file
diff --git a/src/horae/settings.py b/src/horae/settings.py
index a5a2e0f00e..55a645470f 100644
--- a/src/horae/settings.py
+++ b/src/horae/settings.py
@@ -83,11 +83,11 @@ WSGI_APPLICATION = 'horae.wsgi.application'
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.postgresql',
-        'NAME': 'horae_dev',
-        'USER': 'devuser',
-        'PASSWORD': 'devdata',
-        'HOST': 'localhost',
-        'PORT': 9100,
+        'NAME': os.environ.get('DB_NAME', 'horae_dev'),
+        'USER': os.environ.get('DB_USER', 'devuser'),
+        'PASSWORD': os.environ.get('DB_PASSWORD', 'devdata'),
+        'HOST': os.environ.get('DB_HOST', 'localhost'),
+        'PORT': os.environ.get('DB_PORT', 9100),
     }
 }
 
@@ -142,7 +142,9 @@ REST_FRAMEWORK = {
 }
 
 # Elastic search config
-ELASTIC_SEARCH_HOSTS = ['localhost', ]
+ELASTIC_SEARCH_HOSTS = [
+    os.environ.get('ES_HOST', 'localhost'),
+]
 
 # Silent logger for elasticsearch
 import logging
-- 
GitLab