add GET /config
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user