Skip to content

Commit

Permalink
read env var only once
Browse files Browse the repository at this point in the history
  • Loading branch information
lantoli committed Dec 17, 2024
1 parent 61eda15 commit cc01fb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/config/advanced_cluster_v2_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (
const AdvancedClusterV2SchemaEnvVar = "MONGODB_ATLAS_ADVANCED_CLUSTER_V2_SCHEMA"
const allowAdvancedClusterV2Schema = false // Don't allow in master branch yet, not in const block to allow automatic change

// Environment variable is read only once to avoid possible changes during runtime
var advancedClusterV2Schema, _ = strconv.ParseBool(os.Getenv(AdvancedClusterV2SchemaEnvVar))

func AdvancedClusterV2Schema() bool {
env, _ := strconv.ParseBool(os.Getenv(AdvancedClusterV2SchemaEnvVar))
return allowAdvancedClusterV2Schema && env
return allowAdvancedClusterV2Schema && advancedClusterV2Schema
}

0 comments on commit cc01fb9

Please sign in to comment.