Commit 15cf07b0 by lichenggang

用户自行配置

parent 1d972ac5
Showing with 3 additions and 2 deletions
...@@ -21,7 +21,7 @@ func GetCurrentPath() string { ...@@ -21,7 +21,7 @@ func GetCurrentPath() string {
func InitConfig() { func InitConfig() {
flag.StringVar(&Directory, "dir", "/data/inotify_logs", "监听目录") flag.StringVar(&Directory, "dir", "/data/inotify_logs", "监听目录")
flag.StringVar(&Port, "port", "9997", "监听端口") flag.StringVar(&Port, "port", "9997", "监听端口")
flag.Parse()
Directory = "E:\\test_logs" // directory of the log Directory = "E:\\test_logs" // directory of the log
logenv := os.Getenv("GOLOGENV") logenv := os.Getenv("GOLOGENV")
if logenv == "TEST" { if logenv == "TEST" {
......
...@@ -9,9 +9,10 @@ import ( ...@@ -9,9 +9,10 @@ import (
// example // example
func main() { func main() {
addrs := "0.0.0.0:" + config.Port
config.InitConfig() config.InitConfig()
addrs := "0.0.0.0:" + config.Port
fmt.Printf("查看日志目录: %s \n用户配置文件: %s", config.Directory, config.UserConfigPath) fmt.Printf("查看日志目录: %s \n用户配置文件: %s", config.Directory, config.UserConfigPath)
app := code.GetApp(config.Directory) app := code.GetApp(config.Directory)
app.Run(iris.Addr(addrs), iris.WithCharset("UTF-8")) app.Run(iris.Addr(addrs), iris.WithCharset("UTF-8"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment