加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
imail.go 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
midoks 提交于 2022-11-27 15:16 . 0.0.19
package main
import (
"embed"
"os"
"github.com/urfave/cli"
"github.com/midoks/imail/internal/cmd"
"github.com/midoks/imail/internal/conf"
"github.com/midoks/imail/internal/log"
"github.com/midoks/imail/internal/tools"
"github.com/midoks/imail/internal/tools/syscall"
)
const Version = "0.0.19"
const AppName = "imail"
//go:embed templates
var viewsFs embed.FS
//go:embed public/*
var publicFs embed.FS
func init() {
conf.App.Version = Version
conf.App.Name = AppName
conf.App.PublicFs = publicFs
}
func main() {
if tools.IsExist("./logs") {
logFile, err := os.OpenFile("./logs/run_away.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, os.ModePerm)
if err != nil {
panic("Exception capture:Failed to open exception log file")
}
// Redirect the process standard error to the file.
// When the process crashes, the runtime will record the co process call stack information to the file
syscall.Dup2(int(logFile.Fd()), int(os.Stderr.Fd()))
}
app := cli.NewApp()
app.Name = conf.App.Name
app.Version = conf.App.Version
app.Usage = "A simple mail service"
app.Commands = []cli.Command{
cmd.Service,
cmd.Reset,
cmd.Dkim,
cmd.Cert,
cmd.Check,
}
if err := app.Run(os.Args); err != nil {
log.Infof("Failed to start application: %v", err)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化