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:52:03 +02:00
parent ff8fc23ce5
commit be71b844f2
10 changed files with 119 additions and 14 deletions
+5
View File
@@ -4,6 +4,7 @@ package command
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis/pkg/version"
"github.com/owncloud/ocis/ocs/pkg/command"
svcconfig "github.com/owncloud/ocis/ocs/pkg/config"
"github.com/owncloud/ocis/ocs/pkg/flagset"
@@ -18,6 +19,9 @@ func OCSCommand(cfg *config.Config) *cli.Command {
Usage: "Start ocs server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.OCS),
Subcommands: []*cli.Command{
command.PrintVersion(cfg.OCS),
},
Action: func(ctx *cli.Context) error {
ocsCommand := command.Server(configureOCS(cfg))
@@ -34,6 +38,7 @@ func configureOCS(cfg *config.Config) *svcconfig.Config {
cfg.OCS.Log.Level = cfg.Log.Level
cfg.OCS.Log.Pretty = cfg.Log.Pretty
cfg.OCS.Log.Color = cfg.Log.Color
cfg.OCS.Service.Version = version.String
if cfg.Tracing.Enabled {
cfg.OCS.Tracing.Enabled = cfg.Tracing.Enabled