Respect env for debug and routes sub commands (#2026)

This commit is contained in:
Viktor Liu
2024-06-06 10:59:10 +02:00
committed by GitHub
parent 983d7bafbe
commit deffe037aa
3 changed files with 11 additions and 8 deletions

View File

@ -353,8 +353,11 @@ func migrateToNetbird(oldPath, newPath string) bool {
return true
}
func getClient(ctx context.Context) (*grpc.ClientConn, error) {
conn, err := DialClientGRPCServer(ctx, daemonAddr)
func getClient(cmd *cobra.Command) (*grpc.ClientConn, error) {
SetFlagsFromEnvVars(rootCmd)
cmd.SetOut(cmd.OutOrStdout())
conn, err := DialClientGRPCServer(cmd.Context(), daemonAddr)
if err != nil {
return nil, fmt.Errorf("failed to connect to daemon error: %v\n"+
"If the daemon is not running please run: "+