同步配置

This commit is contained in:
wh_zcy 2023-02-15 11:35:54 +08:00
parent 47ab011c6c
commit 69c3d4deef
2 changed files with 20 additions and 0 deletions

View File

@ -126,6 +126,26 @@ func main() {
})
})
// 同步配置
// 接受客户端上传的文件覆盖服务器上文件
r.POST("/sync", func(c *gin.Context) {
f, err := c.FormFile("file")
if err != nil {
log.Print(err)
return
}
if f.Filename!="config.json"{
log.Print("上传的配置文件不是config.json")
return
}
dst := path.Join(*wwwDir, f.Filename)
err = c.SaveUploadedFile(f, dst)
if err != nil {
log.Print(err)
return
}
})
err := r.Run("0.0.0.0:" + *port)
if err != nil {
log.Fatal(err)

BIN
cmd/upgrade/update Normal file

Binary file not shown.