Added json settings

This commit is contained in:
Georg Reisinger 2022-02-01 23:54:52 +01:00
parent 51c7738b12
commit 9a4fcee3dd
3 changed files with 60 additions and 3 deletions

View File

@ -44,4 +44,55 @@ docker run -p 3100:3100 -p 8999:8999 --name ntopngglobe -d dergeorg/ntopngglobe
* Red side of arc is receiving
* Green side of arc is sending
### Settings example
[settings.json](https://git.dergeorg.at/dergeorg/NtopngGlobe/src/branch/master/public/conf/settings.json)
```json
{
"location": {
"home": {
"lat": 48.1,
"lng": 16.3
},
"precision": 0
},
"colors": {
"loc": {
"default": "green",
"dualsender": "orange"
},
"arc": {
"default": [
"green",
"red"
],
"dualsender": [
"orange",
"orange"
]
}
},
"sizes": {
"loc": {
"default": 0.1
},
"arc": {
"default": 1.1
},
"globe": {
"arcDashLength": 0.4,
"arcAltitudeAutoScale": 0.4,
"arcDashGap": 0.1,
"arcDashInitialGap": 0.1,
"arcDashAnimateTime": 7000,
"arcStroke": 0.5,
"labelSize": 0,
"labelDotRadius": 0.4,
"labelResolution": 2
}
},
"timer": {
"del": 30,
"refreshTimer": 1
}
}
```

View File

@ -42,6 +42,7 @@
}
},
"timer": {
"del": 30
"del": 30,
"refreshTimer": 1
}
}

View File

@ -53,6 +53,9 @@ router.get('/alerts/dates', function(req, res, next) {
});
var task = cron.schedule('* * * * *', () => {
if(globe.getSettigns().timer.refreshTimer === 1) {
wss.broadcast("new data is da")
}
const TEN_MINUTES = globe.getSettigns().timer.del*60*1000;
const date = new Date();
alerts.getAlertDates().forEach(ad => {
@ -79,7 +82,9 @@ router.post('/ws', async function(req, res, next) {
if (typeof src !== 'undefined' || typeof dest !== 'undefined')
await globe.addArc(src, dest, uid, item.srv_name, item.cli_name)
}
wss.broadcast("new data is da")
if(globe.getSettigns().timer.refreshTimer === 0) {
wss.broadcast("new data is da")
}
res.sendStatus(200);
})