Cron_Admin/app/utils/helper/env.go

24 lines
374 B
Go
Executable File

package helper
import "os"
const (
DefaultTimeZone = "Asia/Shanghai" // 时区
)
func GetEnv(name string) string {
return os.Getenv(name)
}
func GetEnvWithDefault(name string, defaultValue string) string {
value := GetEnv(name)
if value == "" {
return defaultValue
}
return value
}
func GetTimeZone() string {
return GetEnvWithDefault("TZ", DefaultTimeZone)
}