✨ Uses v2 configration schema
This commit is contained in:
@ -17,7 +17,7 @@ type CliConnection struct {
|
||||
}
|
||||
|
||||
func (v CliConnection) CheckConnectivity() error {
|
||||
client := fiber.Get(v.Url + "/cgi/connectivity")
|
||||
client := fiber.Get(v.Url + "/cgi/metadata")
|
||||
client.BasicAuth("RoadSign CLI", v.Credential)
|
||||
|
||||
if status, data, err := client.Bytes(); len(err) > 0 {
|
||||
|
@ -11,9 +11,9 @@ import (
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/conn"
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/navi"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/pelletier/go-toml/v2"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var DeployCommands = []*cli.Command{
|
||||
@ -78,7 +78,7 @@ var DeployCommands = []*cli.Command{
|
||||
return err
|
||||
} else {
|
||||
raw, _ := io.ReadAll(file)
|
||||
yaml.Unmarshal(raw, &site)
|
||||
toml.Unmarshal(raw, &site)
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("/webhooks/sync/%s", ctx.Args().Get(1))
|
||||
|
@ -21,7 +21,7 @@ func main() {
|
||||
// Configure settings
|
||||
viper.AddConfigPath("$HOME")
|
||||
viper.SetConfigName(".roadsignrc")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigType("toml")
|
||||
|
||||
// Load settings
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/hypertext"
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/navi"
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/sideload"
|
||||
"code.smartsheep.studio/goatworks/roadsign/pkg/sign"
|
||||
"github.com/google/uuid"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -27,7 +26,7 @@ func main() {
|
||||
viper.AddConfigPath(".")
|
||||
viper.AddConfigPath("..")
|
||||
viper.SetConfigName("settings")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.SetConfigType("toml")
|
||||
|
||||
// Load settings
|
||||
if err := viper.ReadInConfig(); err != nil {
|
||||
@ -44,20 +43,15 @@ func main() {
|
||||
log.Warn().Msgf("RoadSign auto generated api credential is %s", credential)
|
||||
}
|
||||
|
||||
// Load & init sign
|
||||
// Load & init navi
|
||||
if err := navi.ReadInConfig(viper.GetString("paths.configs")); err != nil {
|
||||
log.Panic().Err(err).Msg("An error occurred when loading configurations.")
|
||||
} else {
|
||||
log.Info().Int("count", len(sign.App.Sites)).Msg("All configuration has been loaded.")
|
||||
log.Info().Int("count", len(navi.R.Regions)).Msg("All configuration has been loaded.")
|
||||
}
|
||||
|
||||
// Preheat processes
|
||||
go func() {
|
||||
log.Info().Msg("Preheating processes...")
|
||||
sign.App.PreheatProcesses(func(total int, success int) {
|
||||
log.Info().Int("requested", total).Int("succeed", success).Msgf("Preheat processes completed!")
|
||||
})
|
||||
}()
|
||||
// Init warden
|
||||
navi.InitializeWarden(navi.R.Regions)
|
||||
|
||||
// Init hypertext server
|
||||
hypertext.RunServer(
|
||||
|
Reference in New Issue
Block a user