Added webapp Dashboard + logic to interact with server.
[src/xds/xds-agent.git] / lib / apiv1 / config.go
diff --git a/lib/apiv1/config.go b/lib/apiv1/config.go
deleted file mode 100644 (file)
index 47155ed..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package apiv1
-
-import (
-       "net/http"
-       "sync"
-
-       "github.com/gin-gonic/gin"
-       "github.com/iotbzh/xds-agent/lib/xdsconfig"
-       common "github.com/iotbzh/xds-common/golib"
-)
-
-var confMut sync.Mutex
-
-// GetConfig returns the configuration
-func (s *APIService) getConfig(c *gin.Context) {
-       confMut.Lock()
-       defer confMut.Unlock()
-
-       c.JSON(http.StatusOK, s.cfg)
-}
-
-// SetConfig sets configuration
-func (s *APIService) setConfig(c *gin.Context) {
-       // FIXME - must be tested
-       c.JSON(http.StatusNotImplemented, "Not implemented")
-
-       var cfgArg xdsconfig.Config
-
-       if c.BindJSON(&cfgArg) != nil {
-               common.APIError(c, "Invalid arguments")
-               return
-       }
-
-       confMut.Lock()
-       defer confMut.Unlock()
-
-       s.log.Debugln("SET config: ", cfgArg)
-
-       if err := s.cfg.UpdateAll(cfgArg); err != nil {
-               common.APIError(c, err.Error())
-               return
-       }
-
-       c.JSON(http.StatusOK, s.cfg)
-}