From da678a866681e3c08d093d7b0c708337a6870ae0 Mon Sep 17 00:00:00 2001
From: Aymeric Bernard <aymeric.bernard@student.ecp.fr>
Date: Tue, 17 Apr 2018 16:57:42 +0200
Subject: [PATCH] Fix: protocol and port for https for front on server

---
 front/src/config.template.js | 3 ++-
 front/src/socket.js          | 4 ++--
 front/src/style.css          | 1 -
 server/config.template.js    | 1 +
 server/index.js              | 4 ++--
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/front/src/config.template.js b/front/src/config.template.js
index c7260a3..63cf7da 100644
--- a/front/src/config.template.js
+++ b/front/src/config.template.js
@@ -1,4 +1,5 @@
 module.exports = {
-  port: 5000,
+  protocol: 'http',
   host: 'localhost',
+  port: 5000,
 };
diff --git a/front/src/socket.js b/front/src/socket.js
index f2fb6e2..ed2d38a 100644
--- a/front/src/socket.js
+++ b/front/src/socket.js
@@ -1,6 +1,6 @@
-import { port, host } from './config';
+import { protocol, host, port } from './config';
 
-const socketIO = io.connect(`http://${host || 'localhost'}:${port || 3000}/`);
+const socketIO = io.connect(`${protocol}://${host || 'localhost'}:${port}/`);
 
 socketIO.on('connect', () => {
   socketIO.emit('date');
diff --git a/front/src/style.css b/front/src/style.css
index 76e6a41..c8f8807 100644
--- a/front/src/style.css
+++ b/front/src/style.css
@@ -56,7 +56,6 @@ img.row-icon {
   margin-left: 10px;
   padding-top: 10px;
   padding-bottom: 10px;
-  border: 1px solid #ccc;
 }
 
 .image-text-bloc > .text-section > .text-element:last-child {
diff --git a/server/config.template.js b/server/config.template.js
index 8955193..7fc2d89 100644
--- a/server/config.template.js
+++ b/server/config.template.js
@@ -3,6 +3,7 @@ const path = require('path');
 
 module.exports = {
   port: 5000,
+  secure: false,
   uuid: 'UUID A REMPLIR',
   api: {
     url: 'http://api.hermod.cs-campus.fr',
diff --git a/server/index.js b/server/index.js
index 9361359..0e0de98 100644
--- a/server/index.js
+++ b/server/index.js
@@ -2,7 +2,7 @@ const http = require('http');
 const fs = require('fs');
 const path = require('path');
 const socketIO = require('socket.io');
-const { port } = require('./config');
+const { port, secure } = require('./config');
 const socket = require('./socket');
 
 const indexPath = path.resolve(__dirname, '../front/build/index.html');
@@ -29,6 +29,6 @@ const server = (req, res) => {
 const app = http.createServer(server);
 app.listen(port || 3000);
 
-const io = socketIO(app);
+const io = socketIO(app, { secure });
 
 io.of('/').on('connection', socket);
-- 
GitLab