add GET /config

This commit is contained in:
Mikaël Cluseau
2026-07-01 11:05:26 +02:00
parent 38ad620759
commit 9aa942c99d
2 changed files with 17 additions and 0 deletions
+14
View File
@@ -13,6 +13,20 @@ import (
"novit.tech/direktil/pkg/localconfig"
)
func wsFetchConfig(req *restful.Request, resp *restful.Response) {
cfg, err := readConfig()
if err != nil {
if os.IsNotExist(err) {
wsNotFound(resp)
} else {
wsError(resp, httperr.Internal(err))
}
return
}
resp.WriteEntity(cfg)
}
func wsUploadConfig(req *restful.Request, resp *restful.Response) {
cfg := &localconfig.Config{}
if err := req.ReadEntity(cfg); err != nil {