Add version informations
Change-Id: If5a932ea9d51c55a31970540076d362c179081b9
diff --git a/.gitignore b/.gitignore
index 2913dab..22671b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
todo.txt
/vendor
/termmapper
+/cmd/termmapper/termmapper
*.yaml
\#*
-/cmd/termmapper
\ No newline at end of file
+!/cmd/termmapper/
\ No newline at end of file
diff --git a/cmd/termmapper/main.go b/cmd/termmapper/main.go
index 4ba3dff..9b6b8ae 100644
--- a/cmd/termmapper/main.go
+++ b/cmd/termmapper/main.go
@@ -30,14 +30,20 @@
type TemplateData struct {
Title string
Version string
+ Hash string
+ Date string
Description string
MappingIDs []string
}
func parseConfig() *appConfig {
cfg := &appConfig{}
+
+ desc := config.Description
+ desc += " [" + config.Version + "]"
+
ctx := kong.Parse(cfg,
- kong.Description("A web service for transforming JSON objects using term mapping rules."),
+ kong.Description(desc),
kong.UsageOnError(),
)
if ctx.Error != nil {
@@ -228,9 +234,11 @@
// Prepare template data
data := TemplateData{
- Title: "KoralPipe TermMapper - Kalamar Plugin",
- Version: "1.0.0",
- Description: "A KortalPipe web service for transforming JSON objects using term mapping rules.",
+ Title: config.Title,
+ Version: config.Version,
+ Hash: config.Buildhash,
+ Date: config.Buildtime,
+ Description: config.Description,
MappingIDs: mappingIDs,
}
@@ -259,6 +267,8 @@
<div>
<h2>Plugin Information</h2>
<p><strong>Version:</strong> ` + data.Version + `</p>
+ <p><strong>Build Date:</strong> ` + data.Date + `</p>
+ <p><strong>Build Hash:</strong> ` + data.Hash + `</p>
<p><strong>Description:</strong> ` + data.Description + `</p>
</div>
diff --git a/cmd/termmapper/main_test.go b/cmd/termmapper/main_test.go
index 2cbc4a3..00e10b3 100644
--- a/cmd/termmapper/main_test.go
+++ b/cmd/termmapper/main_test.go
@@ -296,6 +296,6 @@
assert.Equal(t, http.StatusOK, resp.StatusCode)
body, err = io.ReadAll(resp.Body)
require.NoError(t, err)
- assert.Contains(t, string(body), "KoralPipe TermMapper - Kalamar Plugin")
+ assert.Contains(t, string(body), "KoralPipe-TermMapper")
}
diff --git a/config/version.go b/config/version.go
new file mode 100644
index 0000000..3cc61c9
--- /dev/null
+++ b/config/version.go
@@ -0,0 +1,19 @@
+package config
+
+const (
+
+ // Title represents the name of this tool.
+ Title string = "KoralPipe-TermMapper"
+
+ // Description represents a short description of this tool.
+ Description string = "A KoralPipe web service for transforming JSON objects using term mapping rules."
+)
+
+// Version represents the SemVer of the server.
+var Version = "[unset]"
+
+// Buildtime represents the timestamp of the build.
+var Buildtime = "[unset]"
+
+// Buildhash represents a unique hash of the build.
+var Buildhash = "[unset]"