mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-23 23:29:15 +01:00
fix(client): add checking on empty config in the gRPC handler (#307)
This commit is contained in:
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.
|
||||
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()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
@ -184,23 +187,30 @@ func (s *Server) Status(ctx context.Context, msg *proto.StatusRequest) (*proto.S
|
||||
}
|
||||
|
||||
// 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()
|
||||
defer s.mutex.Unlock()
|
||||
|
||||
managementURL := s.managementURL
|
||||
if managementURL == "" && s.config.ManagementURL != nil {
|
||||
managementURL = s.config.ManagementURL.String()
|
||||
}
|
||||
|
||||
adminURL := s.adminURL
|
||||
if s.config.AdminURL != nil {
|
||||
adminURL = s.config.AdminURL.String()
|
||||
}
|
||||
preSharedKey := ""
|
||||
|
||||
preSharedKey := s.config.PreSharedKey
|
||||
if preSharedKey != "" {
|
||||
preSharedKey = "**********"
|
||||
if s.config != nil {
|
||||
if managementURL == "" && s.config.ManagementURL != nil {
|
||||
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{
|
||||
|
Loading…
Reference in New Issue
Block a user