Support none database type to disable stats/telemetry

Fixes #21
This commit is contained in:
Maddie Zhan
2021-09-18 01:48:10 +08:00
parent 7204ae2e19
commit 8c1aa6b39b
7 changed files with 55 additions and 5 deletions
+7
View File
@@ -4,6 +4,7 @@ import (
"html/template"
"net/http"
"github.com/go-chi/render"
log "github.com/sirupsen/logrus"
"github.com/librespeed/speedtest/config"
@@ -27,6 +28,12 @@ func Stats(w http.ResponseWriter, r *http.Request) {
}
conf := config.LoadedConfig()
if conf.DatabaseType == "none" {
render.PlainText(w, r, "Statistics are disabled")
return
}
var data StatsData
if conf.StatsPassword == "PASSWORD" {