Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Add ENV VAR FLTYE_ADMIN_ENDPOINT (#4948)
Browse files Browse the repository at this point in the history
Signed-off-by: zychen5186 <[email protected]>
  • Loading branch information
zychen5186 committed Mar 22, 2024
1 parent 559a47a commit 6f014e5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/core/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ package cmdcore
import (
"context"
"fmt"
"net/url"
"os"

"github.com/pkg/errors"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/flyteorg/flyte/flyteidl/clients/go/admin"
stdConfig "github.com/flyteorg/flyte/flytestdlib/config"
"github.com/flyteorg/flytectl/cmd/config"
"github.com/flyteorg/flytectl/pkg/pkce"

Expand Down Expand Up @@ -66,6 +69,18 @@ func generateCommandFunc(cmdEntry CommandEntry) func(cmd *cobra.Command, args []
}

adminCfg := admin.GetConfig(ctx)

if len(os.Getenv("FLTYE_ADMIN_ENDPOINT")) > 0 {
envEndpoint, err := url.Parse(os.Getenv("FLTYE_ADMIN_ENDPOINT"))
if err != nil {
fmt.Println("Error parsing URL:", err)
return err
}
adminCfg.Endpoint = stdConfig.URL{
URL: *envEndpoint,
}
}

if len(adminCfg.Endpoint.String()) == 0 {
return cmdEntry.CmdFunc(ctx, args, CommandContext{})
}
Expand Down

0 comments on commit 6f014e5

Please sign in to comment.