config download
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
package webui
|
||||
|
||||
import "gopkg.in/macaron.v1"
|
||||
import (
|
||||
"path"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
func backupPage(ctx *macaron.Context) {
|
||||
ctx.HTML(200, "backup")
|
||||
}
|
||||
|
||||
func backupDownload(ctx *macaron.Context) {
|
||||
cfgFile := viper.ConfigFileUsed()
|
||||
_, fileName := path.Split(cfgFile)
|
||||
ctx.ServeFile(cfgFile, fileName)
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ func StartServer() {
|
||||
m.Post("/ups", binding.Bind(UPSPostForm{}), upsPost)
|
||||
m.Get("/syslog", syslogPage)
|
||||
m.Get("/backup", backupPage)
|
||||
m.Post("/backup", backupDownload)
|
||||
m.Get("/json/status", jsonStatus)
|
||||
m.Post("/json/outlet/:id/toggle", jsonOutletToggle)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user