mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-22 06:14:39 -04:00
add ocis-pkg/config default config + fix logging inheritance
This commit is contained in:
11 files changed
+152
-249
No files matched your search
@@ -5,10 +5,8 @@ package command
|
||||
|
||||
import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/proxy/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis/proxy/pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
@@ -25,33 +23,12 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
origCmd := command.Server(configureProxy(cfg))
|
||||
origCmd := command.Server(cfg.Proxy)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureProxy(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Proxy.OcisURL = cfg.OcisURL
|
||||
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
|
||||
cfg.Proxy.Tracing.Type = cfg.Tracing.Type
|
||||
cfg.Proxy.Tracing.Endpoint = cfg.Tracing.Endpoint
|
||||
cfg.Proxy.Tracing.Collector = cfg.Tracing.Collector
|
||||
}
|
||||
|
||||
if cfg.TokenManager.JWTSecret != "" {
|
||||
cfg.Proxy.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
|
||||
}
|
||||
|
||||
return cfg.Proxy
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(ProxyCommand)
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package command
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/ocis/pkg/flagset"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -15,14 +13,13 @@ import (
|
||||
|
||||
// Execute is the entry point for the ocis command.
|
||||
func Execute() error {
|
||||
cfg := config.New()
|
||||
cfg := config.DefaultConfig()
|
||||
|
||||
app := &cli.App{
|
||||
Name: "ocis",
|
||||
Version: version.String,
|
||||
Usage: "ownCloud Infinite Scale Stack",
|
||||
Compiled: version.Compiled(),
|
||||
Flags: flagset.RootWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis/pkg/flagset"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/ocis/pkg/runtime"
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -19,13 +18,12 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start fullstack server",
|
||||
Category: "Fullstack",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
return nil
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
r := runtime.New(cfg)
|
||||
|
||||
Reference in new issue
Block a user