github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/extension/environment.go (about) 1 package extension 2 3 import ( 4 "os" 5 "sync" 6 ) 7 8 // environmentIsExtension is the cached result of the extension environment 9 // check. 10 var environmentIsExtension bool 11 12 // checkEnvironmentOnce gates access to environmentIsExtension. 13 var checkEnvironmentOnce sync.Once 14 15 // EnvironmentIsExtension returns true if the current operating environment is 16 // the Mutagen Extension for Docker Desktop service container. 17 func EnvironmentIsExtension() bool { 18 checkEnvironmentOnce.Do(func() { 19 environmentIsExtension = os.Getenv("MUTAGEN_EXTENSION") == "1" 20 }) 21 return environmentIsExtension 22 }