Last active
August 28, 2019 15:32
-
-
Save kanzitelli/115c55b652879bea19b13b168d10b9f6 to your computer and use it in GitHub Desktop.
utils/utils.go #1 - 📰Good News app. Golang backend behind Traefik reverse proxy with https available.
This file contains hidden or 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 utils | |
import ( | |
"log" | |
"github.com/kelseyhightower/envconfig" | |
) | |
// EnvVariables <struct> | |
// is used to descrive environment variables structure of a project | |
type EnvVariables struct { | |
DebugMode bool | |
} | |
var variables *EnvVariables | |
// InitEnvVars <function> | |
// is used to initialize environment variables of a project | |
func InitEnvVars() { | |
variables = new(EnvVariables) | |
err := envconfig.Process("api", variables) | |
if err != nil { | |
log.Fatal(err) | |
} | |
} | |
// GetEnvVars <function> | |
// is used to return current environment variables | |
func GetEnvVars() *EnvVariables { | |
return variables | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment