main
zggsong 2 years ago
parent a964630a70
commit 5c821745e1

@ -26,7 +26,7 @@ func InitialConfig() model.Config {
viper.AddConfigPath("../config")
viper.AddConfigPath(filePath)
viper.OnConfigChange(func(e fsnotify.Event) {
log.Tracef("配置文件更新: %v", e.Name)
log.Infof("配置文件更新: %v", e.Name)
global.GLO_CONFIG_CHAN <- getConfig()
})
viper.WatchConfig()

@ -13,6 +13,10 @@ import (
)
func init() {
// 监听目录下文件
global.GLO_RECV_CHAN = make(chan map[string]string)
global.GLO_CONFIG_CHAN = make(chan model.Config)
// 初始化日志
logger := &lumberjack.Logger{
//Filename: "./Log/Receive_File_Log" + time.Now().Format("20060102_150405") + ".txt",
@ -36,7 +40,7 @@ func init() {
if err != nil {
err = os.Mkdir("upload", 0755)
if err != nil {
log.Fatal("[ERROR] Could not create upload directory...")
log.Fatal("Could not create upload directory...")
return
}
log.Infof("Created Upload Directory")
@ -44,10 +48,6 @@ func init() {
}
func main() {
// 监听目录下文件
global.GLO_RECV_CHAN = make(chan map[string]string)
global.GLO_CONFIG_CHAN = make(chan model.Config)
mux := http.NewServeMux()
mux.HandleFunc("/", serve.HandlerRoot)
mux.HandleFunc("/upload", serve.HandlerSingleFile)

Loading…
Cancel
Save