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

Commit 15debc2

Browse files
committed
Modify var names
Signed-off-by: zychen5186 <[email protected]>
1 parent 514e52f commit 15debc2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cmd/config/env_var_reader.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@ import (
1212

1313
const flyteAdminEndpoint = "FLYTE_ADMIN_ENDPOINT"
1414

15-
type FuncType func() error
15+
type UpdateFunc func(context.Context) error
1616

17-
var funcMap = map[string]FuncType{flyteAdminEndpoint: updateAdminEndpoint}
17+
var envToUpdateFunc = map[string]UpdateFunc{flyteAdminEndpoint: updateAdminEndpoint}
1818

1919
func UpdateConfigWithEnvVar() error {
20-
for envVar, f := range funcMap {
20+
ctx := context.Background()
21+
22+
for envVar, updateFunc := range envToUpdateFunc {
2123
if os.Getenv(envVar) != "" {
22-
if err := f(); err != nil {
24+
if err := updateFunc(ctx); err != nil {
2325
return fmt.Errorf("error update config with env var: %v", err)
2426
}
2527
}
2628
}
2729
return nil
2830
}
2931

30-
func updateAdminEndpoint() error {
31-
ctx := context.Background()
32+
func updateAdminEndpoint(ctx context.Context) error {
3233
cfg := admin.GetConfig(ctx)
3334

3435
if len(os.Getenv(flyteAdminEndpoint)) > 0 {

0 commit comments

Comments
 (0)