remove version from service config

This commit is contained in:
Willy Kloucek
2022-01-03 16:24:39 +01:00
committed by Jörn Friedrich Dreyer
parent b9f2b6b91e
commit adc7b3b3d2
40 changed files with 70 additions and 58 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/owncloud/ocis/accounts/pkg/server/http"
svc "github.com/owncloud/ocis/accounts/pkg/service/v0"
"github.com/owncloud/ocis/accounts/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)
@@ -41,7 +42,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
mtrcs.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
mtrcs.BuildInfo.WithLabelValues(version.String).Set(1)
handler, err := svc.New(svc.Logger(logger), svc.Config(cfg))
if err != nil {

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -3,6 +3,7 @@ package grpc
import (
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
)
// Server initializes a new go-micro service ready to run
@@ -17,7 +18,7 @@ func Server(opts ...Option) grpc.Service {
grpc.Namespace(options.Config.GRPC.Namespace),
grpc.Logger(options.Logger),
grpc.Flags(options.Flags...),
grpc.Version(options.Config.Service.Version),
grpc.Version(version.String),
)
if err := proto.RegisterAccountsServiceHandler(service.Server(), handler); err != nil {

View File

@@ -21,7 +21,7 @@ func Server(opts ...Option) http.Service {
service := http.NewService(
http.Logger(options.Logger),
http.Name(options.Name),
http.Version(options.Config.Service.Version),
http.Version(version.String),
http.Address(options.Config.HTTP.Addr),
http.Namespace(options.Config.HTTP.Namespace),
http.Context(options.Context),

View File

@@ -15,6 +15,7 @@ import (
"github.com/owncloud/ocis/glauth/pkg/tracing"
pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)
@@ -49,7 +50,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
{

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/owncloud/ocis/graph-explorer/pkg/server/debug"
"github.com/owncloud/ocis/graph-explorer/pkg/server/http"
"github.com/owncloud/ocis/graph-explorer/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)
@@ -41,7 +42,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
mtrcs.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
mtrcs.BuildInfo.WithLabelValues(version.String).Set(1)
{
server, err := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/owncloud/ocis/graph/pkg/server/debug"
"github.com/owncloud/ocis/graph/pkg/server/http"
"github.com/owncloud/ocis/graph/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)
@@ -45,7 +46,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
mtrcs.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
mtrcs.BuildInfo.WithLabelValues(version.String).Set(1)
{
server, err := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -11,6 +11,7 @@ import (
"github.com/owncloud/ocis/idp/pkg/server/debug"
"github.com/owncloud/ocis/idp/pkg/server/http"
"github.com/owncloud/ocis/idp/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)
@@ -45,7 +46,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
{
server, err := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -6,6 +6,7 @@ import (
"github.com/owncloud/ocis/idp/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
)
// Server initializes the debug service and server.
@@ -15,7 +16,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -9,6 +9,7 @@ import (
pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/ocis-pkg/version"
"go-micro.dev/v4"
)
@@ -42,7 +43,7 @@ func Server(opts ...Option) (http.Service, error) {
http.Logger(options.Logger),
http.Namespace(options.Config.HTTP.Namespace),
http.Name(options.Config.Service.Name),
http.Version(options.Config.Service.Version),
http.Version(version.String),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(options.Flags...),
@@ -60,7 +61,7 @@ func Server(opts ...Option) (http.Service, error) {
middleware.Secure,
middleware.Version(
options.Config.Service.Name,
options.Config.Service.Version,
version.String,
),
middleware.Logger(
options.Logger,

View File

@@ -3,6 +3,7 @@ package command
import (
"context"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/ocs/pkg/config/parser"
"github.com/owncloud/ocis/ocs/pkg/logging"
"github.com/owncloud/ocis/ocs/pkg/tracing"
@@ -47,7 +48,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
{
server, err := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/ocs/pkg/config"
)
@@ -15,7 +16,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -5,6 +5,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/cors"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/ocis-pkg/version"
ocsmw "github.com/owncloud/ocis/ocs/pkg/middleware"
svc "github.com/owncloud/ocis/ocs/pkg/service/v0"
"go-micro.dev/v4"
@@ -17,7 +18,7 @@ func Server(opts ...Option) (http.Service, error) {
service := http.NewService(
http.Logger(options.Logger),
http.Name(options.Config.Service.Name),
http.Version(options.Config.Service.Version),
http.Version(version.String),
http.Namespace(options.Config.HTTP.Namespace),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
@@ -39,7 +40,10 @@ func Server(opts ...Option) (http.Service, error) {
cors.AllowCredentials(options.Config.HTTP.CORS.AllowCredentials),
),
middleware.Secure,
middleware.Version(options.Config.Service.Name, options.Config.Service.Version),
middleware.Version(
options.Config.Service.Name,
version.String,
),
middleware.Logger(options.Logger),
ocsmw.LogTrace,
),

View File

@@ -15,6 +15,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/log"
pkgmiddleware "github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/config/parser"
"github.com/owncloud/ocis/proxy/pkg/cs3"
@@ -64,7 +65,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
m.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
m.BuildInfo.WithLabelValues(version.String).Set(1)
rp := proxy.NewMultiHostReverseProxy(
proxy.Logger(logger),

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -6,6 +6,7 @@ import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/proxy/pkg/config"
)
@@ -16,7 +17,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -6,6 +6,7 @@ import (
pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto"
svc "github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/ocis-pkg/version"
"go-micro.dev/v4"
)
@@ -43,7 +44,7 @@ func Server(opts ...Option) (svc.Service, error) {
service := svc.NewService(
svc.Name(options.Config.Service.Name),
svc.Version(options.Config.Service.Version),
svc.Version(version.String),
svc.TLSConfig(tlsConfig),
svc.Logger(options.Logger),
svc.Address(options.Config.HTTP.Addr),

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/oklog/run"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/settings/pkg/config"
"github.com/owncloud/ocis/settings/pkg/config/parser"
"github.com/owncloud/ocis/settings/pkg/logging"
@@ -44,7 +45,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
mtrcs := metrics.New()
mtrcs.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
mtrcs.BuildInfo.WithLabelValues(version.String).Set(1)
// prepare an HTTP server and add it to the group run.
httpServer := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -2,6 +2,7 @@ package grpc
import (
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/settings/pkg/proto/v0"
svc "github.com/owncloud/ocis/settings/pkg/service/v0"
)
@@ -13,7 +14,7 @@ func Server(opts ...Option) grpc.Service {
service := grpc.NewService(
grpc.Logger(options.Logger),
grpc.Name(options.Name),
grpc.Version(options.Config.Service.Version),
grpc.Version(version.String),
grpc.Address(options.Config.GRPC.Addr),
grpc.Namespace(options.Config.GRPC.Namespace),
grpc.Context(options.Context),

View File

@@ -21,7 +21,7 @@ func Server(opts ...Option) http.Service {
service := http.NewService(
http.Logger(options.Logger),
http.Name(options.Name),
http.Version(options.Config.Service.Version),
http.Version(version.String),
http.Address(options.Config.HTTP.Addr),
http.Namespace(options.Config.HTTP.Namespace),
http.Context(options.Context),

View File

@@ -5,6 +5,7 @@ import (
"github.com/oklog/run"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/store/pkg/config"
"github.com/owncloud/ocis/store/pkg/config/parser"
"github.com/owncloud/ocis/store/pkg/logging"
@@ -47,7 +48,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
{
server := grpc.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/store/pkg/config"
)
@@ -15,7 +16,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -2,6 +2,7 @@ package grpc
import (
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/store/pkg/proto/v0"
svc "github.com/owncloud/ocis/store/pkg/service/v0"
)
@@ -13,7 +14,7 @@ func Server(opts ...Option) grpc.Service {
service := grpc.NewService(
grpc.Namespace(options.Config.GRPC.Namespace),
grpc.Name(options.Config.Service.Name),
grpc.Version(options.Config.Service.Version),
grpc.Version(version.String),
grpc.Context(options.Context),
grpc.Address(options.Config.GRPC.Addr),
grpc.Logger(options.Logger),

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/oklog/run"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/thumbnails/pkg/config"
"github.com/owncloud/ocis/thumbnails/pkg/config/parser"
"github.com/owncloud/ocis/thumbnails/pkg/logging"
@@ -46,7 +47,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
service := grpc.NewService(
grpc.Logger(logger),

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/thumbnails/pkg/config"
)
@@ -15,7 +16,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -22,7 +22,7 @@ func NewService(opts ...Option) grpc.Service {
grpc.Address(options.Address),
grpc.Context(options.Context),
grpc.Flags(options.Flags...),
grpc.Version(options.Config.Service.Version),
grpc.Version(version.String),
)
tconf := options.Config.Thumbnail
gc, err := pool.GetGatewayServiceClient(tconf.RevaGateway)

View File

@@ -1,7 +1,5 @@
package config
import "github.com/owncloud/ocis/ocis-pkg/version"
func DefaultConfig() *Config {
return &Config{
Debug: Debug{
@@ -17,8 +15,7 @@ func DefaultConfig() *Config {
CacheTTL: 604800, // 7 days
},
Service: Service{
Name: "web",
Version: version.String, // TODO: ensure everywhere or remove
Name: "web",
},
Tracing: Tracing{
Enabled: false,

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/oklog/run"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/webdav/pkg/config"
"github.com/owncloud/ocis/webdav/pkg/config/parser"
"github.com/owncloud/ocis/webdav/pkg/logging"
@@ -47,7 +48,7 @@ func Server(cfg *config.Config) *cli.Command {
defer cancel()
metrics.BuildInfo.WithLabelValues(cfg.Service.Version).Set(1)
metrics.BuildInfo.WithLabelValues(version.String).Set(1)
{
server, err := http.Server(

View File

@@ -2,6 +2,5 @@ package config
// Service defines the available service configuration.
type Service struct {
Name string
Version string
Name string
}

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/webdav/pkg/config"
)
@@ -15,7 +16,7 @@ func Server(opts ...Option) (*http.Server, error) {
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
debug.Version(options.Config.Service.Version),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),

View File

@@ -5,6 +5,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/cors"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/ocis-pkg/version"
svc "github.com/owncloud/ocis/webdav/pkg/service/v0"
"go-micro.dev/v4"
)
@@ -17,7 +18,7 @@ func Server(opts ...Option) (http.Service, error) {
http.Logger(options.Logger),
http.Namespace(options.Config.HTTP.Namespace),
http.Name(options.Config.Service.Name),
http.Version(options.Config.Service.Version),
http.Version(version.String),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(options.Flags...),
@@ -40,7 +41,7 @@ func Server(opts ...Option) (http.Service, error) {
middleware.Secure,
middleware.Version(
options.Config.Service.Name,
options.Config.Service.Version,
version.String,
),
middleware.Logger(
options.Logger,