mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-09 23:27:58 +02:00
fix(client): add checking on empty config in the gRPC handler (#307)
This commit is contained in:
committed by
GitHub
parent
c7e5e5c7c9
commit
fbf778a221
@ -171,7 +171,10 @@ func (s *Server) Down(ctx context.Context, msg *proto.DownRequest) (*proto.DownR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Status starts engine work in the daemon.
|
// Status starts engine work in the daemon.
|
||||||
func (s *Server) Status(ctx context.Context, msg *proto.StatusRequest) (*proto.StatusResponse, error) {
|
func (s *Server) Status(
|
||||||
|
ctx context.Context,
|
||||||
|
msg *proto.StatusRequest,
|
||||||
|
) (*proto.StatusResponse, error) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
defer s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
|
|
||||||
@ -184,23 +187,30 @@ func (s *Server) Status(ctx context.Context, msg *proto.StatusRequest) (*proto.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetConfig of the daemon.
|
// GetConfig of the daemon.
|
||||||
func (s *Server) GetConfig(ctx context.Context, msg *proto.GetConfigRequest) (*proto.GetConfigResponse, error) {
|
func (s *Server) GetConfig(
|
||||||
|
ctx context.Context,
|
||||||
|
msg *proto.GetConfigRequest,
|
||||||
|
) (*proto.GetConfigResponse, error) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
defer s.mutex.Unlock()
|
defer s.mutex.Unlock()
|
||||||
|
|
||||||
managementURL := s.managementURL
|
managementURL := s.managementURL
|
||||||
if managementURL == "" && s.config.ManagementURL != nil {
|
|
||||||
managementURL = s.config.ManagementURL.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
adminURL := s.adminURL
|
adminURL := s.adminURL
|
||||||
if s.config.AdminURL != nil {
|
preSharedKey := ""
|
||||||
adminURL = s.config.AdminURL.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
preSharedKey := s.config.PreSharedKey
|
if s.config != nil {
|
||||||
if preSharedKey != "" {
|
if managementURL == "" && s.config.ManagementURL != nil {
|
||||||
preSharedKey = "**********"
|
managementURL = s.config.ManagementURL.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.config.AdminURL != nil {
|
||||||
|
adminURL = s.config.AdminURL.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
preSharedKey = s.config.PreSharedKey
|
||||||
|
if preSharedKey != "" {
|
||||||
|
preSharedKey = "**********"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &proto.GetConfigResponse{
|
return &proto.GetConfigResponse{
|
||||||
|
Reference in New Issue
Block a user