Compare commits

...

3 Commits

3 changed files with 33 additions and 7 deletions

View File

@ -1,6 +1,9 @@
package depenv
import "os"
import (
"fmt"
"os"
)
var manageServers = map[DeploymentEnvironment]string{
DeployDevel: "https://manage.askdev.grundclock.com",
@ -65,3 +68,16 @@ func (d DeploymentEnvironment) APIHost() string {
func (d DeploymentEnvironment) ManageURL(path string) string {
return manageServers[d] + path
}
func (d *DeploymentEnvironment) UnmarshalText(text []byte) error {
s := string(text)
if s == "" {
return nil
}
env := DeploymentEnvironmentFromString(s)
if env == DeployUndefined {
return fmt.Errorf("invalid deployment environment: %s", s)
}
*d = env
return nil
}

View File

@ -2,7 +2,7 @@
set -euo pipefail
go install github.com/goreleaser/goreleaser/v2@v2.5.1
go install github.com/goreleaser/goreleaser/v2@v2.8.2
if [ ! -z "${harbor_username:-}" ]; then
DOCKER_FILE=~/.docker/config.json

View File

@ -13,10 +13,12 @@ import (
)
// VERSION has the current software version (set in the build process)
var VERSION string
var buildTime string
var gitVersion string
var gitModified bool
var (
VERSION string
buildTime string
gitVersion string
gitModified bool
)
var info Info
@ -28,7 +30,6 @@ type Info struct {
}
func init() {
info.BuildTime = buildTime
info.GitRev = gitVersion
@ -90,6 +91,15 @@ func VersionCmd(name string) *cobra.Command {
return versionCmd
}
type KongVersionCmd struct {
Name string `kong:"-"`
}
func (cmd *KongVersionCmd) Run() error {
fmt.Printf("%s %s\n", cmd.Name, Version())
return nil
}
func RegisterMetric(name string, registry prometheus.Registerer) {
if len(name) > 0 {
name = strings.ReplaceAll(name, "-", "_")