github.com/rudderlabs/rudder-go-kit@v0.30.0/config/misc.go (about) 1 package config 2 3 import ( 4 "os" 5 ) 6 7 // GetWorkspaceToken returns the workspace token provided in the environment variables 8 // Env variable CONFIG_BACKEND_TOKEN is deprecating soon 9 // WORKSPACE_TOKEN is newly introduced. This will override CONFIG_BACKEND_TOKEN 10 func GetWorkspaceToken() string { 11 token := GetString("WORKSPACE_TOKEN", "") 12 if token != "" && token != "<your_token_here>" { 13 return token 14 } 15 return GetString("CONFIG_BACKEND_TOKEN", "") 16 } 17 18 // GetNamespaceIdentifier returns value stored in KUBE_NAMESPACE env var or "none" if empty 19 func GetNamespaceIdentifier() string { 20 k8sNamespace := GetKubeNamespace() 21 if k8sNamespace != "" { 22 return k8sNamespace 23 } 24 return "none" 25 } 26 27 // GetKubeNamespace returns value stored in KUBE_NAMESPACE env var 28 func GetKubeNamespace() string { 29 return os.Getenv("KUBE_NAMESPACE") 30 } 31 32 func GetReleaseName() string { 33 return os.Getenv("RELEASE_NAME") 34 }