Created
July 15, 2016 10:15
-
-
Save kavirajk/025c3f916a1ab9f055fc82a9c327f8c8 to your computer and use it in GitHub Desktop.
Load config from environment variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package envron | |
import ( | |
"log" | |
"os" | |
) | |
func MustEnv(key string) (value string) { | |
if value = os.Getenv(key); value == "" { | |
log.Fatalf("ENV %q is not set.", key) | |
} | |
return value | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment