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), }, } }