同步配置
This commit is contained in:
parent
47ab011c6c
commit
69c3d4deef
@ -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
BIN
cmd/upgrade/update
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user