Skip to content

Commit 60fcbad

Browse files
authored
read env var only once (#2899)
1 parent b1ad17c commit 60fcbad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/config/advanced_cluster_v2_schema.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import (
88
const AdvancedClusterV2SchemaEnvVar = "MONGODB_ATLAS_ADVANCED_CLUSTER_V2_SCHEMA"
99
const allowAdvancedClusterV2Schema = false // Don't allow in master branch yet, not in const block to allow automatic change
1010

11+
// Environment variable is read only once to avoid possible changes during runtime
12+
var advancedClusterV2Schema, _ = strconv.ParseBool(os.Getenv(AdvancedClusterV2SchemaEnvVar))
13+
1114
func AdvancedClusterV2Schema() bool {
12-
env, _ := strconv.ParseBool(os.Getenv(AdvancedClusterV2SchemaEnvVar))
13-
return allowAdvancedClusterV2Schema && env
15+
return allowAdvancedClusterV2Schema && advancedClusterV2Schema
1416
}

0 commit comments

Comments
 (0)