feat(auth): Add login, register, session_info and api creation
This commit is contained in:
22
app/utils/env.go
Normal file
22
app/utils/env.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetEnv(key, defaultValue string) string {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func GetEnvBool(key string, defaultValue bool) bool {
|
||||
value := strings.ToLower(GetEnv(key, ""))
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
return value == "true" || value == "1"
|
||||
}
|
||||
Reference in New Issue
Block a user