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,8 +4,11 @@ import (
"github.com/librespeed/speedtest/config"
"github.com/librespeed/speedtest/database/bolt"
"github.com/librespeed/speedtest/database/mysql"
"github.com/librespeed/speedtest/database/none"
"github.com/librespeed/speedtest/database/postgresql"
"github.com/librespeed/speedtest/database/schema"
log "github.com/sirupsen/logrus"
)
var (
@@ -26,5 +29,9 @@ func SetDBInfo(conf *config.Config) {
DB = mysql.Open(conf.DatabaseHostname, conf.DatabaseUsername, conf.DatabasePassword, conf.DatabaseName)
case "bolt":
DB = bolt.Open(conf.DatabaseFile)
case "none":
DB = none.Open("")
default:
log.Fatalf("Unsupported database type: %s", conf.DatabaseType)
}
}