Skip to content

Instantly share code, notes, and snippets.

@kavirajk
Created July 15, 2016 10:15
Show Gist options
  • Save kavirajk/025c3f916a1ab9f055fc82a9c327f8c8 to your computer and use it in GitHub Desktop.
Save kavirajk/025c3f916a1ab9f055fc82a9c327f8c8 to your computer and use it in GitHub Desktop.
Load config from environment variables
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