From 02b5a9d223668496b0e6156cf8227157d0fcee32 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Wed, 24 Nov 2021 11:44:32 +0100 Subject: [PATCH 1/2] deleted http, grpc and debug from ocis-pkg/config/config.go --- ocis-pkg/config/config.go | 63 -------------------------------------- ocis/pkg/command/health.go | 55 --------------------------------- ocis/pkg/command/server.go | 6 ---- 3 files changed, 124 deletions(-) delete mode 100644 ocis/pkg/command/health.go diff --git a/ocis-pkg/config/config.go b/ocis-pkg/config/config.go index c2c78541e9d..e73c9d07e61 100644 --- a/ocis-pkg/config/config.go +++ b/ocis-pkg/config/config.go @@ -18,25 +18,6 @@ import ( webdav "github.com/owncloud/ocis/webdav/pkg/config" ) -// Debug defines the available debug configuration. -type Debug struct { - Addr string `ocisConfig:"addr"` - Token string `ocisConfig:"token"` - Pprof bool `ocisConfig:"pprof"` - Zpages bool `ocisConfig:"zpages"` -} - -// HTTP defines the available http configuration. -type HTTP struct { - Addr string `ocisConfig:"addr"` - Root string `ocisConfig:"root"` -} - -// GRPC defines the available grpc configuration. -type GRPC struct { - Addr string `ocisConfig:"addr"` -} - // Tracing defines the available tracing configuration. type Tracing struct { Enabled bool `ocisConfig:"enabled"` @@ -78,9 +59,6 @@ type Config struct { Registry string `ocisConfig:"registry"` Log shared.Log `ocisConfig:"log"` - Debug Debug `ocisConfig:"debug"` - HTTP HTTP `ocisConfig:"http"` - GRPC GRPC `ocisConfig:"grpc"` Tracing Tracing `ocisConfig:"tracing"` TokenManager TokenManager `ocisConfig:"token_manager"` Runtime Runtime `ocisConfig:"runtime"` @@ -121,19 +99,6 @@ func New() *Config { func DefaultConfig() *Config { return &Config{ - Debug: Debug{ - Addr: "127.0.0.1:9010", - Token: "", - Pprof: false, - Zpages: false, - }, - HTTP: HTTP{ - Addr: "127.0.0.1:9000", - Root: "/", - }, - GRPC: GRPC{ - Addr: "127.0.0.1:9001", - }, Tracing: Tracing{ Enabled: false, Type: "jaeger", @@ -232,34 +197,6 @@ func structMappings(cfg *Config) []shared.EnvBinding { EnvVars: []string{"OCIS_RUNTIME_HOST"}, Destination: &cfg.Runtime.Host, }, - { - EnvVars: []string{"OCIS_DEBUG_ADDR"}, - Destination: &cfg.Debug.Addr, - }, - { - EnvVars: []string{"OCIS_DEBUG_TOKEN"}, - Destination: &cfg.Debug.Token, - }, - { - EnvVars: []string{"OCIS_DEBUG_PPROF"}, - Destination: &cfg.Debug.Pprof, - }, - { - EnvVars: []string{"OCIS_DEBUG_ZPAGES"}, - Destination: &cfg.Debug.Zpages, - }, - { - EnvVars: []string{"OCIS_HTTP_ADDR"}, - Destination: &cfg.HTTP.Addr, - }, - { - EnvVars: []string{"OCIS_HTTP_ROOT"}, - Destination: &cfg.HTTP.Root, - }, - { - EnvVars: []string{"OCIS_GRPC_ADDR"}, - Destination: &cfg.GRPC.Addr, - }, { EnvVars: []string{"OCIS_RUN_EXTENSIONS"}, Destination: &cfg.Runtime.Extensions, diff --git a/ocis/pkg/command/health.go b/ocis/pkg/command/health.go deleted file mode 100644 index f293dbf8faa..00000000000 --- a/ocis/pkg/command/health.go +++ /dev/null @@ -1,55 +0,0 @@ -package command - -import ( - "fmt" - "net/http" - - "github.com/owncloud/ocis/ocis-pkg/config" - "github.com/owncloud/ocis/ocis/pkg/register" - "github.com/urfave/cli/v2" -) - -// Health is the entrypoint for the health command. -func Health(cfg *config.Config) *cli.Command { - return &cli.Command{ - Name: "health", - Usage: "Check health status", - Before: func(c *cli.Context) error { - return ParseConfig(c, cfg) - }, - Action: func(c *cli.Context) error { - logger := NewLogger(cfg) - - resp, err := http.Get( - fmt.Sprintf( - "http://%s/healthz", - cfg.Debug.Addr, - ), - ) - - if err != nil { - logger.Fatal(). - Err(err). - Msg("Failed to request health check") - } - - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - logger.Fatal(). - Int("code", resp.StatusCode). - Msg("Health seems to be in bad state") - } - - logger.Debug(). - Int("code", resp.StatusCode). - Msg("Health got a good state") - - return nil - }, - } -} - -func init() { - register.AddCommand(Health) -} diff --git a/ocis/pkg/command/server.go b/ocis/pkg/command/server.go index 336a39e87a4..c750340e8be 100644 --- a/ocis/pkg/command/server.go +++ b/ocis/pkg/command/server.go @@ -4,8 +4,6 @@ package command import ( - "strings" - "github.com/owncloud/ocis/ocis-pkg/shared" "github.com/owncloud/ocis/ocis-pkg/config" @@ -21,10 +19,6 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start fullstack server", Category: "Fullstack", Before: func(c *cli.Context) error { - if cfg.HTTP.Root != "/" { - cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") - } - return ParseConfig(c, cfg) }, Action: func(c *cli.Context) error { From 36be70c71413c2d578fd65df0708ba431e7046bd Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Wed, 24 Nov 2021 11:48:07 +0100 Subject: [PATCH 2/2] added changelog --- changelog/unreleased/ocis-pkg-config-cleanup.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/ocis-pkg-config-cleanup.md diff --git a/changelog/unreleased/ocis-pkg-config-cleanup.md b/changelog/unreleased/ocis-pkg-config-cleanup.md new file mode 100644 index 00000000000..e1464c4c9e9 --- /dev/null +++ b/changelog/unreleased/ocis-pkg-config-cleanup.md @@ -0,0 +1,5 @@ +Enhancement: Cleanup ocis-pkg config + +Certain values were of no use when configuring the ocis runtime. + +https://github.com/owncloud/ocis/pull/2813