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

Commit

Permalink
Modify var names
Browse files Browse the repository at this point in the history
Signed-off-by: zychen5186 <[email protected]>
  • Loading branch information
zychen5186 committed Apr 2, 2024
1 parent 514e52f commit 15debc2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/config/env_var_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@ import (

const flyteAdminEndpoint = "FLYTE_ADMIN_ENDPOINT"

type FuncType func() error
type UpdateFunc func(context.Context) error

var funcMap = map[string]FuncType{flyteAdminEndpoint: updateAdminEndpoint}
var envToUpdateFunc = map[string]UpdateFunc{flyteAdminEndpoint: updateAdminEndpoint}

func UpdateConfigWithEnvVar() error {
for envVar, f := range funcMap {
ctx := context.Background()

for envVar, updateFunc := range envToUpdateFunc {
if os.Getenv(envVar) != "" {
if err := f(); err != nil {
if err := updateFunc(ctx); err != nil {
return fmt.Errorf("error update config with env var: %v", err)
}

Check warning on line 26 in cmd/config/env_var_reader.go

View check run for this annotation

Codecov / codecov/patch

cmd/config/env_var_reader.go#L25-L26

Added lines #L25 - L26 were not covered by tests
}
}
return nil
}

func updateAdminEndpoint() error {
ctx := context.Background()
func updateAdminEndpoint(ctx context.Context) error {
cfg := admin.GetConfig(ctx)

if len(os.Getenv(flyteAdminEndpoint)) > 0 {
Expand Down

0 comments on commit 15debc2

Please sign in to comment.