1 package constants 2 3 import ( 4 "os" 5 ) 6 7 func GetConfigVar(key string) string { 8 if os.Getenv("ROLE") == "prod" { 9 key += "_PROD" 10 } else if os.Getenv("ROLE") == "dev" { 11 key += "_DEV" 12 } else { 13 panic("Application has not been executed correctly. Specify environment variable 'ROLE' as either 'dev' or 'prod'") 14 } 15 return os.Getenv(key) 16 } 17