Private
Public Access
1
0

scorer: configurable default source

This commit is contained in:
2024-01-20 21:35:18 -07:00
parent 6df51fc19f
commit 2f2a407409

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"math"
"net/http"
"os"
"strconv"
"strings"
"time"
@@ -167,10 +168,18 @@ func (srv *Server) history(c echo.Context) error {
var history *logscores.LogScoreHistory
if c.QueryParam("source") == "c" {
history, err = srv.getHistoryCH(ctx, c, p)
} else {
sourceParam := c.QueryParam("source")
switch sourceParam {
case "m":
case "c":
default:
sourceParam = os.Getenv("default_source")
}
if sourceParam == "m" {
history, err = srv.getHistoryMySQL(ctx, c, p)
} else {
history, err = srv.getHistoryCH(ctx, c, p)
}
if err != nil {
var httpError *echo.HTTPError