Commit 0deccc70 authored by Eric Chiang's avatar Eric Chiang

cmd: add version to command worker and overlord, print go version

Closes #272
parent b5c7f197
......@@ -7,6 +7,8 @@ import (
"net/http"
"net/url"
"os"
"runtime"
"strings"
"time"
"github.com/coreos/go-oidc/key"
......@@ -50,6 +52,8 @@ func main() {
logDebug := fs.Bool("log-debug", false, "log debug-level information")
logTimestamps := fs.Bool("log-timestamps", false, "prefix log lines with timestamps")
printVersion := fs.Bool("version", false, "Print the version and exit")
if err := fs.Parse(os.Args[1:]); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
......@@ -60,6 +64,11 @@ func main() {
os.Exit(1)
}
if *printVersion {
fmt.Printf("dex version %s\ngo version %s\n", strings.TrimPrefix(version, "v"), strings.TrimPrefix(runtime.Version(), "go"))
os.Exit(0)
}
if *logDebug {
log.EnableDebug()
}
......
......@@ -7,6 +7,8 @@ import (
"net/http"
"net/url"
"os"
"runtime"
"strings"
"time"
"github.com/coreos/pkg/flagutil"
......@@ -62,6 +64,7 @@ func main() {
dbMaxIdleConns := fs.Int("db-max-idle-conns", 0, "maximum number of connections in the idle connection pool")
dbMaxOpenConns := fs.Int("db-max-open-conns", 0, "maximum number of open connections to the database")
printVersion := fs.Bool("version", false, "Print the version and exit")
// used only if --no-db is set
connectors := fs.String("connectors", "./static/fixtures/connectors.json", "JSON file containg set of IDPC configs")
......@@ -81,6 +84,11 @@ func main() {
os.Exit(1)
}
if *printVersion {
fmt.Printf("dex version %s\ngo version %s\n", strings.TrimPrefix(version, "v"), strings.TrimPrefix(runtime.Version(), "go"))
os.Exit(0)
}
if *logDebug {
log.EnableDebug()
log.Infof("Debug logging enabled.")
......
package main
import "github.com/spf13/cobra"
import (
"runtime"
"strings"
"github.com/spf13/cobra"
)
var (
// set by the top level build script
......@@ -11,7 +16,7 @@ var (
Short: "Print the dexctl version.",
Long: "Print the dexctl version.",
Run: func(cmd *cobra.Command, args []string) {
stdout(version)
stdout("dex version %s\ngo version %s", strings.TrimPrefix(version, "v"), strings.TrimPrefix(runtime.Version(), "go"))
},
}
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment