summaryrefslogtreecommitdiffstats
path: root/lib/apiv1/version.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-15 11:12:21 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-15 19:08:31 +0200
commitbfeab33538d50ee52750de4dd4c0e72b64f674f6 (patch)
treea8ebab2a62f4ca4ccbfbe848106ca53d708c724b /lib/apiv1/version.go
Initial commit.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/apiv1/version.go')
-rw-r--r--lib/apiv1/version.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/apiv1/version.go b/lib/apiv1/version.go
new file mode 100644
index 0000000..e022441
--- /dev/null
+++ b/lib/apiv1/version.go
@@ -0,0 +1,24 @@
+package apiv1
+
+import (
+ "net/http"
+
+ "github.com/gin-gonic/gin"
+)
+
+type version struct {
+ Version string `json:"version"`
+ APIVersion string `json:"apiVersion"`
+ VersionGitTag string `json:"gitTag"`
+}
+
+// getInfo : return various information about server
+func (s *APIService) getVersion(c *gin.Context) {
+ response := version{
+ Version: s.cfg.Version,
+ APIVersion: s.cfg.APIVersion,
+ VersionGitTag: s.cfg.VersionGitTag,
+ }
+
+ c.JSON(http.StatusOK, response)
+}