1 Star 0 Fork 0

非空非零 / jupiter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.go 612 Bytes
一键复制 编辑 原始数据 按行查看 历史
MEX7 提交于 2020-08-31 22:57 . feat: support mongo & support sentinel
package application
import (
"os"
"time"
)
func init() {
hn, err := os.Hostname()
if err != nil {
panic(err)
}
hostname = hn
}
// 通用状态信息
type RuntimeStats struct {
IP string `json:"ip"`
Hostname string `json:"hostname"`
Time string `json:"time"` // 每次展示数据的时间
Err string `json:"err"`
}
func NewRuntimeStats() RuntimeStats {
return RuntimeStats{
IP: EnvServerHost(),
Hostname: Hostname(),
Time: time.Now().Format("2006-01-02 15:04:05"),
}
}
var hostname string
// Hostname gets hostname.
func Hostname() string {
return hostname
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nonull/eden.git
git@gitee.com:nonull/eden.git
nonull
eden
jupiter
v0.3.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891