From 52a88d75257dfa82433380d120da4e4cd89d1b45 Mon Sep 17 00:00:00 2001
From: Ferenc Schulcz <schulcz.ferenc@gmail.com>
Date: Thu, 19 May 2022 10:17:32 +0200
Subject: [PATCH] Dockerize solution

---
 db/db.js | 4 +++-
 index.js | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/db/db.js b/db/db.js
index bee4b2f..67563ca 100644
--- a/db/db.js
+++ b/db/db.js
@@ -1,6 +1,8 @@
 var mongoose = require('mongoose');
 
-mongoose.connect('mongodb://localhost/szobatinder');
+const db_url = process.env.DB_HOST ? 'mongodb://' + process.env.DB_HOST + '/szobatinder' : 'mongodb://localhost/szobatinder'
+
+mongoose.connect(db_url);
 
 // Users
 //------
diff --git a/index.js b/index.js
index 35c70ef..7595682 100644
--- a/index.js
+++ b/index.js
@@ -66,7 +66,7 @@ app.post('/profile', authMW(), profileeditMW());
 app.get('/deleteprofile', authMW(), profiledeleteMW());
 
 const server_port = 3000;
-const server_domain = 'localhost';
+const server_domain = '0.0.0.0';
 app.listen(server_port, server_domain, function () {
     console.log(`This server is listening on http://${server_domain}:${server_port}`);
 });
\ No newline at end of file
-- 
GitLab