From 7240621ead65b3b279370784514b7253ddbc587d Mon Sep 17 00:00:00 2001 From: Medzik Date: Thu, 9 Sep 2021 18:55:36 +0000 Subject: [PATCH] fix: delete cluster option (not used in latest config) --- config/toml.go | 5 ----- database/mongo/getAll.go | 6 +----- pre-commit.sh | 3 +++ website/routes/api/status.go | 9 +++------ 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/config/toml.go b/config/toml.go index 239a1eb..16a6536 100644 --- a/config/toml.go +++ b/config/toml.go @@ -14,7 +14,6 @@ type tomlConfig struct { HTTP httpConfig Backend backendConfig AutoUpdate autoUpdateConfig - Cluster clusterConfig MongoDB mongoDBConfig Options optionsConfig } @@ -34,10 +33,6 @@ type autoUpdateConfig struct { Check time.Duration } -type clusterConfig struct { - ID int -} - type mongoDBConfig struct { Database string Collection string diff --git a/database/mongo/getAll.go b/database/mongo/getAll.go index 9c7e384..500d3b3 100644 --- a/database/mongo/getAll.go +++ b/database/mongo/getAll.go @@ -3,8 +3,6 @@ package mongo import ( "context" "time" - - "gitlab.com/gaming0skar123/go/pingbot/config" ) func GetAll() ([]URL, error) { @@ -13,9 +11,7 @@ func GetAll() ([]URL, error) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() - cursor, err := Coll.Find(ctx, URL{ - Cluster: config.Toml.Cluster.ID, - }) + cursor, err := Coll.Find(ctx, URL{}) if err != nil { return nil, err } diff --git a/pre-commit.sh b/pre-commit.sh index 1f62b99..98990ab 100755 --- a/pre-commit.sh +++ b/pre-commit.sh @@ -4,3 +4,6 @@ go mod tidy # Lint go fmt ./... + +# Add changes +git add . diff --git a/website/routes/api/status.go b/website/routes/api/status.go index d7d39ed..16173ff 100644 --- a/website/routes/api/status.go +++ b/website/routes/api/status.go @@ -34,8 +34,9 @@ func Status(c *gin.Context) { c.JSON(http.StatusOK, json{ "ping": p, "sys": json{ - "pid": cpu.PID, - "os": runtime.GOOS, + "uptime": common.Uptime(config.StartTime), + "pid": cpu.PID, + "os": runtime.GOOS, "mem": json{ "alloc": mem.Alloc, "totalalloc": mem.TotalAlloc, @@ -53,9 +54,5 @@ func Status(c *gin.Context) { "release": config.Version, "build": config.Build, }, - "node": json{ - "cluster": config.Toml.Cluster.ID, - "uptime": common.Uptime(config.StartTime), - }, }) }