mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 09:49:32 +02:00
Make the ping interval configurable
This commit is contained in:
parent
0ecb7e4830
commit
2ccdbfdd87
3 changed files with 10 additions and 4 deletions
|
@ -68,6 +68,8 @@ This fixes the causes of lint warnings (where possible).
|
|||
- DISABLE_SIGNUP
|
||||
- ``yes`` or ``no`` (default: no)
|
||||
- disables creating new families if ``yes`` is selected
|
||||
- PING_INTERVAL_SEC
|
||||
- ping interval at the websocket in seconds
|
||||
|
||||
## HTTPS
|
||||
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// note: soem configuration parameters are read directly at the location where they are used
|
||||
// note: some configuration parameters are read directly at the location where they are used
|
||||
interface Config {
|
||||
mailWhitelist: Array<string>
|
||||
disableSignup: boolean
|
||||
pingInterval: number
|
||||
}
|
||||
|
||||
function parseYesNo (value: string) {
|
||||
|
@ -33,5 +34,6 @@ function parseYesNo (value: string) {
|
|||
|
||||
export const config: Config = {
|
||||
mailWhitelist: (process.env.MAIL_WHITELIST || '').split(',').map((item) => item.trim()).filter((item) => item.length > 0),
|
||||
disableSignup: parseYesNo(process.env.DISABLE_SIGNUP || 'no')
|
||||
disableSignup: parseYesNo(process.env.DISABLE_SIGNUP || 'no'),
|
||||
pingInterval: parseInt(process.env.PING_INTERVAL_SEC || '25', 10) * 1000
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -17,6 +17,7 @@
|
|||
|
||||
import { Server } from 'http'
|
||||
import { createApi } from './api'
|
||||
import { config } from './config'
|
||||
import { VisibleConnectedDevicesManager } from './connected-devices'
|
||||
import { defaultDatabase, defaultUmzug } from './database'
|
||||
import { EventHandler } from './monitoring/eventhandler'
|
||||
|
@ -53,7 +54,8 @@ async function main () {
|
|||
const server = new Server(api)
|
||||
|
||||
websocketServer.attach(server, {
|
||||
serveClient: false
|
||||
serveClient: false,
|
||||
pingInterval: config.pingInterval
|
||||
})
|
||||
|
||||
server.listen(process.env.PORT || 8080)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue