add version command and add build information to metrics

Signed-off-by: David Christofas <dchristofas@owncloud.com>
This commit is contained in:
David Christofas
2020-09-25 13:31:14 +02:00
parent ff8fc23ce5
commit 0578092c6f
13 changed files with 142 additions and 32 deletions

View File

@@ -4,11 +4,12 @@ package command
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis/pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/ocis/pkg/version"
"github.com/owncloud/ocis/proxy/pkg/command"
svcconfig "github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/flagset"
"github.com/owncloud/ocis/ocis/pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
)
// ProxyCommand is the entry point for the proxy command.
@@ -18,6 +19,9 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
Usage: "Start proxy server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.Proxy),
Subcommands: []*cli.Command{
command.PrintVersion(cfg.Proxy),
},
Action: func(ctx *cli.Context) error {
proxyCommand := command.Server(configureProxy(cfg))
@@ -34,6 +38,7 @@ func configureProxy(cfg *config.Config) *svcconfig.Config {
cfg.Proxy.Log.Level = cfg.Log.Level
cfg.Proxy.Log.Pretty = cfg.Log.Pretty
cfg.Proxy.Log.Color = cfg.Log.Color
cfg.Proxy.Service.Version = version.String
if cfg.Tracing.Enabled {
cfg.Proxy.Tracing.Enabled = cfg.Tracing.Enabled