♻️ RoadSign v2 #6
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
/config
|
||||
/letsencrypt
|
||||
|
||||
.DS_Store
|
@ -43,7 +43,7 @@ func main() {
|
||||
log.Warn().Msgf("RoadSign auto generated api credential is %s", credential)
|
||||
}
|
||||
|
||||
// Load & init navi
|
||||
// Load & init navigator
|
||||
if err := navi.ReadInConfig(viper.GetString("paths.configs")); err != nil {
|
||||
log.Panic().Err(err).Msg("An error occurred when loading configurations.")
|
||||
} else {
|
||||
|
@ -14,4 +14,4 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
var AppVersion = "1.2.1"
|
||||
var AppVersion = "2.0.0-delta1"
|
||||
|
@ -1,10 +1,12 @@
|
||||
package navi
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
)
|
||||
@ -21,6 +23,8 @@ func ReadInConfig(root string) error {
|
||||
var region Region
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
} else if !strings.HasSuffix(info.Name(), ".toml") {
|
||||
return nil
|
||||
} else if file, err := os.OpenFile(fp, os.O_RDONLY, 0755); err != nil {
|
||||
return err
|
||||
} else if data, err := io.ReadAll(file); err != nil {
|
||||
|
@ -54,11 +54,11 @@ func InitSideload() *fiber.App {
|
||||
{
|
||||
cgi.Get("/metadata", getMetadata)
|
||||
cgi.Get("/traces", getTraces)
|
||||
cgi.Get("/statistics", getStatistics)
|
||||
cgi.Get("/sites", getRegions)
|
||||
cgi.Get("/sites/cfg/:id", getRegionConfig)
|
||||
cgi.Get("/processes", getApplications)
|
||||
cgi.Get("/processes/logs/:id", getApplicationLogs)
|
||||
cgi.Get("/stats", getStats)
|
||||
cgi.Get("/regions", getRegions)
|
||||
cgi.Get("/regions/cfg/:id", getRegionConfig)
|
||||
cgi.Get("/applications", getApplications)
|
||||
cgi.Get("/applications/logs/:id", getApplicationLogs)
|
||||
}
|
||||
|
||||
webhooks := app.Group("/webhooks").Name("WebHooks")
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func getStatistics(c *fiber.Ctx) error {
|
||||
func getStats(c *fiber.Ctx) error {
|
||||
locations := lo.FlatMap(navi.R.Regions, func(item *navi.Region, idx int) []navi.Location {
|
||||
return item.Locations
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user