default division 생성 수정

This commit is contained in:
2023-12-26 16:38:11 +09:00
parent da68071e97
commit bb9b3a9735

View File

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