Skip to content
Snippets Groups Projects
Commit fe48bf23 authored by Aymeric Bernard's avatar Aymeric Bernard
Browse files

Server config: useDummyAPI and useDummyNFC

parent eebe5532
Branches
No related tags found
No related merge requests found
...@@ -4,6 +4,8 @@ const path = require('path'); ...@@ -4,6 +4,8 @@ const path = require('path');
module.exports = { module.exports = {
port: 5000, port: 5000,
secure: false, secure: false,
useDummyAPI: false,
useDummyNFC: false,
uuid: 'UUID A REMPLIR', uuid: 'UUID A REMPLIR',
api: { api: {
url: 'http://api.hermod.cs-campus.fr', url: 'http://api.hermod.cs-campus.fr',
......
...@@ -2,7 +2,7 @@ const fetch = require('node-fetch'); ...@@ -2,7 +2,7 @@ const fetch = require('node-fetch');
const path = require('path'); const path = require('path');
const { const {
uuid, fontSize, rowHeight, api, uuid, fontSize, rowHeight, api, useDummyNFC, useDummyAPI,
} = require('./config'); } = require('./config');
const { spawn } = require('child_process'); const { spawn } = require('child_process');
...@@ -11,8 +11,6 @@ const dummyResponse = require('./dummyResponse.json'); ...@@ -11,8 +11,6 @@ const dummyResponse = require('./dummyResponse.json');
const { createSignedJWT, interval } = require('./utils'); const { createSignedJWT, interval } = require('./utils');
const useDummy = false;
let version; let version;
const checkVersion = (newVersion) => { const checkVersion = (newVersion) => {
...@@ -43,7 +41,7 @@ const doScreenApiRequest = (socket, userid = null) => { ...@@ -43,7 +41,7 @@ const doScreenApiRequest = (socket, userid = null) => {
}; };
const setChrono = (socket) => { const setChrono = (socket) => {
if (useDummy) { if (useDummyAPI) {
return interval(() => socket.emit('panel_data', dummyResponse), 10000); return interval(() => socket.emit('panel_data', dummyResponse), 10000);
} }
return interval(() => doScreenApiRequest(socket), 10000); return interval(() => doScreenApiRequest(socket), 10000);
...@@ -64,7 +62,11 @@ module.exports = (socket) => { ...@@ -64,7 +62,11 @@ module.exports = (socket) => {
chrono.stop(); chrono.stop();
}); });
const badgeChild = spawn(path.resolve(__dirname, '../scripts/nfc-poll-wrapper.sh')); const script = (useDummyNFC)
? '../scripts/nfc-poll-wrapper-dummy.sh'
: '../scripts/nfc-poll-wrapper.sh';
const badgeChild = spawn(path.resolve(__dirname, script));
badgeChild.stdout.on('data', (data0) => { badgeChild.stdout.on('data', (data0) => {
const userid = data0.toString().trim(); const userid = data0.toString().trim();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment