Skip to content

Commit

Permalink
Enforcing the check of env value (#423)
Browse files Browse the repository at this point in the history
This PR checks the value of the Environmental value in addition to just
checking its definition as it is currently implemented.

Co-authored-by: John Belamaric <[email protected]>
  • Loading branch information
rravindran123 and johnbelamaric authored Nov 6, 2023
1 parent 82290d3 commit 048d979
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions operators/nephio-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ func parseReconcilers(reconcilers string) []string {
}

func reconcilerIsEnabled(reconcilers []string, reconciler string) bool {

if slices.Contains(reconcilers, "*") {
return true
}
if slices.Contains(reconcilers, reconciler) {
return true
}
if _, found := os.LookupEnv(fmt.Sprintf("ENABLE_%s", strings.ToUpper(reconciler))); found {
return true
if val, found := os.LookupEnv(fmt.Sprintf("ENABLE_%s", strings.ToUpper(reconciler))); found {
if val == "true" {
return true
}
}
return false
}

0 comments on commit 048d979

Please sign in to comment.