diff --git a/Readme.md b/Readme.md
index b8ecbf4..36f03bd 100644
--- a/Readme.md
+++ b/Readme.md
@@ -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
diff --git a/src/config.ts b/src/config.ts
index 508c89f..58d7f46 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -15,10 +15,11 @@
* along with this program. If not, see .
*/
-// 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
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
}
diff --git a/src/index.ts b/src/index.ts
index 0634072..1afb5af 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -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)