From bb9b3a9735e49530b7918229dd2e991c7df9b5cd Mon Sep 17 00:00:00 2001 From: mountain Date: Tue, 26 Dec 2023 16:38:11 +0900 Subject: [PATCH] =?UTF-8?q?default=20division=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/maingate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/maingate.go b/core/maingate.go index 5e9d287..7131a91 100644 --- a/core/maingate.go +++ b/core/maingate.go @@ -395,6 +395,8 @@ func (mg *Maingate) prepare(context context.Context) (err error) { return nil } +var portptr = flagx.Int("port", 80, "") + func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMux, prefix string) error { var allServices []*serviceDescription if err := mg.mongoClient.AllAs(CollectionService, &allServices, options.Find().SetReturnKey(false)); err != nil { @@ -414,7 +416,6 @@ func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMu } if *devflag { - host, _ := os.Hostname() addrs, err := net.InterfaceAddrs() if err != nil { return logger.ErrorWithCallStack(err) @@ -429,13 +430,13 @@ func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMu } empty.Divisions = map[string]*Division{ - host: { + "default": { DivisionForUser: DivisionForUser{ Priority: 0, State: DivisionState_FullOpen, }, - Url: fmt.Sprintf("http://%s/warehouse", ipaddr), + Url: fmt.Sprintf("http://%s:%d/warehouse", ipaddr, *portptr), }, } }