chore: rename `backend` to `ping`

This commit is contained in:
Medzik 2021-09-08 20:18:35 +00:00
parent 614054e446
commit 5ebc9a5b0a
10 changed files with 26 additions and 20 deletions

View File

@ -10,9 +10,9 @@ import (
"github.com/MedzikUser/go-utils/common"
"github.com/MedzikUser/go-utils/updater"
"github.com/jpillora/opts"
"gitlab.com/gaming0skar123/go/pingbot/backend"
"gitlab.com/gaming0skar123/go/pingbot/config"
"gitlab.com/gaming0skar123/go/pingbot/database/mongo"
"gitlab.com/gaming0skar123/go/pingbot/ping"
"gitlab.com/gaming0skar123/go/pingbot/website"
)
@ -124,7 +124,7 @@ func main() {
}
if config.Toml.Options.Stop_After_Ping {
backend.StopAfterPing()
ping.StopAfterPing()
os.Exit(0)
}
@ -138,7 +138,7 @@ func main() {
if config.Toml.Backend.Enabled {
wg.Add(1)
go backend.Ticker()
go ping.Ticker()
} else {
log.Warn("Backend -> Disabled")
}

View File

@ -1,4 +1,4 @@
package backend
package ping
import (
"time"

View File

@ -1,4 +1,4 @@
package backend
package ping
import (
"context"

View File

@ -1,4 +1,4 @@
package backend
package ping
var Status StatusType

View File

@ -1,4 +1,4 @@
package backend
package ping
import (
"os"

View File

@ -1,4 +1,4 @@
package backend
package ping
import (
"time"

6
pre-commit.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/bash
go mod tidy
# Lint
go fmt ./...

View File

@ -1,5 +1,5 @@
# MongoDB
MONGODB_URI=mongodb+srv://...
MONGO_URI=mongodb+srv://...
# GitHub
GH_TOKEN=ghp_

View File

@ -4,14 +4,14 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"gitlab.com/gaming0skar123/go/pingbot/backend"
"gitlab.com/gaming0skar123/go/pingbot/ping"
)
func GetAll(c *gin.Context) {
backend.Cache()
ping.Cache()
c.JSON(http.StatusOK, json{
"success": true,
"db": backend.CacheURL,
"db": ping.CacheURL,
})
}

View File

@ -7,8 +7,8 @@ import (
"github.com/MedzikUser/go-utils/common"
"github.com/MedzikUser/go-utils/stats"
"github.com/gin-gonic/gin"
"gitlab.com/gaming0skar123/go/pingbot/backend"
"gitlab.com/gaming0skar123/go/pingbot/config"
"gitlab.com/gaming0skar123/go/pingbot/ping"
)
func Status(c *gin.Context) {
@ -19,20 +19,20 @@ func Status(c *gin.Context) {
cpu, err := stats.CPU()
common.CheckErr(err, "cpu stat")
var ping json
var p json
if config.Toml.Backend.Enabled {
ping = json{
"all": backend.Status.Error + backend.Status.Success,
"success": backend.Status.Success,
"err": backend.Status.Error,
p = json{
"all": ping.Status.Error + ping.Status.Success,
"success": ping.Status.Success,
"err": ping.Status.Error,
}
} else {
ping = nil
p = nil
}
c.JSON(http.StatusOK, json{
"ping": ping,
"ping": p,
"sys": json{
"pid": cpu.PID,
"os": runtime.GOOS,