🐛 Bug fixes on server register

This commit is contained in:
LittleSheep 2024-06-22 21:16:56 +08:00
parent dc86e33b9e
commit a4ad17b038
4 changed files with 10 additions and 8 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.21.6
require ( require (
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745
git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210 git.solsynth.dev/hydrogen/passport v0.0.0-20240622131052-18ae5f12e2e7
github.com/go-playground/validator/v10 v10.17.0 github.com/go-playground/validator/v10 v10.17.0
github.com/gofiber/fiber/v2 v2.52.4 github.com/gofiber/fiber/v2 v2.52.4
github.com/gofiber/template/html/v2 v2.1.1 github.com/gofiber/template/html/v2 v2.1.1

2
go.sum
View File

@ -2,6 +2,8 @@ git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745 h1:40BUsQ
git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo= git.solsynth.dev/hydrogen/paperclip v0.0.0-20240622051057-0f56dba45745/go.mod h1:FsQGSLTl0gvo+9Jmbot02S72suyF9tFTrzDj70Xhifo=
git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210 h1:DM4AVhG/l3cOfmhA5IDFgn120BL2PEATnPQDtINIS/Q= git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210 h1:DM4AVhG/l3cOfmhA5IDFgn120BL2PEATnPQDtINIS/Q=
git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210/go.mod h1:XTNEOv75sZI52sNgpum7Z/tgYmlRcHfK7VdhyV7kc0w= git.solsynth.dev/hydrogen/passport v0.0.0-20240622050421-7007cda8f210/go.mod h1:XTNEOv75sZI52sNgpum7Z/tgYmlRcHfK7VdhyV7kc0w=
git.solsynth.dev/hydrogen/passport v0.0.0-20240622131052-18ae5f12e2e7 h1:4zoeDzrAY9/C9RaXsfv7vDE0cC/j94IR1vVpIQEEB6A=
git.solsynth.dev/hydrogen/passport v0.0.0-20240622131052-18ae5f12e2e7/go.mod h1:tUr7x1v0trG3ALDacdDuhJiPRPgFhJ1Si9OqNlYbgSk=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=

View File

@ -18,11 +18,10 @@ func Register() error {
return err return err
} }
httpBind := strings.SplitN(viper.GetString("bind"), ":", 2)
grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2) grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2)
outboundIp, _ := GetOutboundIP() outboundIp, _ := GetOutboundIP()
port, _ := strconv.Atoi(httpBind[1]) port, _ := strconv.Atoi(grpcBind[1])
registration := new(api.AgentServiceRegistration) registration := new(api.AgentServiceRegistration)
registration.ID = viper.GetString("id") registration.ID = viper.GetString("id")

View File

@ -1,7 +1,11 @@
package main package main
import ( import (
"git.solsynth.dev/hydrogen/interactive/pkg/internal" "os"
"os/signal"
"syscall"
pkg "git.solsynth.dev/hydrogen/interactive/pkg/internal"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/grpc" "git.solsynth.dev/hydrogen/interactive/pkg/internal/grpc"
@ -11,9 +15,6 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/viper" "github.com/spf13/viper"
"os"
"os/signal"
"syscall"
) )
func init() { func init() {
@ -42,7 +43,7 @@ func main() {
// Connect other services // Connect other services
if err := gap.Register(); err != nil { if err := gap.Register(); err != nil {
log.Fatal().Err(err).Msg("An error occurred when connecting to paperclip...") log.Fatal().Err(err).Msg("An error occurred when connecting to consul...")
} else { } else {
gap.NewHyperClient() gap.NewHyperClient()
} }