Ai
1 Star 0 Fork 0

非空非零/jupiter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
env.go 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
renzhentao 提交于 2021-06-21 15:02 +08:00 . 1
package pkg
import (
"crypto/md5"
"fmt"
"os"
"gitee.com/nonull/eden/pkg/constant"
)
var (
appLogDir string
appMode string
appRegion string
appZone string
appHost string
appInstance string
)
func InitEnv() {
appLogDir = os.Getenv(constant.EnvAppLogDir)
appMode = os.Getenv(constant.EnvAppMode)
appRegion = os.Getenv(constant.EnvAppRegion)
appZone = os.Getenv(constant.EnvAppZone)
appHost = os.Getenv(constant.EnvAppHost)
appInstance = os.Getenv(constant.EnvAppInstance)
if appInstance == "" {
appInstance = fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%s:%s", HostName(), AppID()))))
}
}
func AppLogDir() string {
return appLogDir
}
func SetAppLogDir(logDir string) {
appLogDir = logDir
}
func AppMode() string {
return appMode
}
func SetAppMode(mode string) {
appMode = mode
}
func AppRegion() string {
return appRegion
}
func SetAppRegion(region string) {
appRegion = region
}
func AppZone() string {
return appZone
}
func SetAppZone(zone string) {
appZone = zone
}
func AppHost() string {
return appHost
}
func SetAppHost(host string) {
appHost = host
}
func AppInstance() string {
return appInstance
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nonull/eden.git
git@gitee.com:nonull/eden.git
nonull
eden
jupiter
v0.3.1

搜索帮助