mirror of
https://github.com/usememos/memos.git
synced 2025-11-10 01:10:52 +08:00
fix: resolve gRPC Gateway connection issue when server address is empty (#4968)
Signed-off-by: ChaoLiu <chaoliu719@gmail.com>
This commit is contained in:
parent
506b477d50
commit
3427ae75ba
1 changed files with 5 additions and 1 deletions
|
|
@ -67,7 +67,11 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store
|
||||||
func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error {
|
func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Echo) error {
|
||||||
var target string
|
var target string
|
||||||
if len(s.Profile.UNIXSock) == 0 {
|
if len(s.Profile.UNIXSock) == 0 {
|
||||||
target = fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port)
|
addr := s.Profile.Addr
|
||||||
|
if addr == "" {
|
||||||
|
addr = "localhost"
|
||||||
|
}
|
||||||
|
target = fmt.Sprintf("%s:%d", addr, s.Profile.Port)
|
||||||
} else {
|
} else {
|
||||||
target = fmt.Sprintf("unix:%s", s.Profile.UNIXSock)
|
target = fmt.Sprintf("unix:%s", s.Profile.UNIXSock)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue