diff --git a/go.mod b/go.mod index 4e3c6d3..3127f68 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golang-jwt/jwt v3.2.2+incompatible go.mongodb.org/mongo-driver v1.11.7 google.golang.org/api v0.128.0 - repositories.action2quare.com/ayo/gocommon v0.0.0-20231116105647-72a62b678f83 + repositories.action2quare.com/ayo/gocommon v0.0.0-20231123013925-8adef2adb814 ) require ( diff --git a/go.sum b/go.sum index 869915b..beedf4d 100644 --- a/go.sum +++ b/go.sum @@ -268,5 +268,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -repositories.action2quare.com/ayo/gocommon v0.0.0-20231116105647-72a62b678f83 h1:0X/ZTLb71JQ+ksZyPdLkxAHz9nDTT+/qRjV/zYBzlMc= -repositories.action2quare.com/ayo/gocommon v0.0.0-20231116105647-72a62b678f83/go.mod h1:XvklTTSvQX5uviivGBcZo8eIL+mV94W2e4uBBXcT5JY= +repositories.action2quare.com/ayo/gocommon v0.0.0-20231123013925-8adef2adb814 h1:3K7YBlNbm7AJJLt8LJ2iDHxgJG5vL7hE1VvdG7VwKCM= +repositories.action2quare.com/ayo/gocommon v0.0.0-20231123013925-8adef2adb814/go.mod h1:XvklTTSvQX5uviivGBcZo8eIL+mV94W2e4uBBXcT5JY= diff --git a/main.go b/main.go index c7effe8..795f517 100644 --- a/main.go +++ b/main.go @@ -21,23 +21,27 @@ func main() { logger.Println("build revision =", revision) ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + mg, err := core.New(ctx) if err != nil { logger.Error("core.New failed :", err) - panic(err) + return } + defer mg.Destructor() serveMux := http.NewServeMux() if err := mg.RegisterHandlers(ctx, serveMux, *prefix); err != nil { logger.Error("RegisterHandlers failed :", err) - panic(err) + return } server := gocommon.NewHTTPServer(serveMux) logger.Println("maingate is started") + if err := server.Start(); err != nil { logger.Error("maingate is stopped with error :", err) } - cancel() - mg.Destructor() + + logger.Println("maingate is terminated") } diff --git a/make_maingate_package.ps1 b/make_maingate_package.ps1 deleted file mode 100644 index dd5aae7..0000000 --- a/make_maingate_package.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -# $ErrorActionPreference = 'SilentlyContinue' - -$CurBranch = git branch --show-current - -Remove-Item maingate.zip -Force -Recurse -ErrorAction SilentlyContinue - -$Env:GOOS="linux" -$Env:GOARCH="amd64" -go build -ldflags="-s -w" . - -Compress-Archive -Path maingate -Update -DestinationPath maingate.zip -Compress-Archive -Path *-firebase-*.json -Update -DestinationPath maingate.zip -Compress-Archive -Path fba -Update -DestinationPath maingate.zip -Compress-Archive -Path template -Update -DestinationPath maingate.zip