ensure, that each config is only parsed once

This commit is contained in:
Willy Kloucek
2022-01-03 19:08:11 +01:00
parent e37eff7dc8
commit 11466c5f9a
38 changed files with 70 additions and 262 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/clihelper"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/thumbnails/pkg/config"
"github.com/owncloud/ocis/thumbnails/pkg/config/parser"
"github.com/thejerf/suture/v4"
"github.com/urfave/cli/v2"
)
@@ -29,11 +28,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
// Execute is the entry point for the ocis-thumbnails command.
func Execute(cfg *config.Config) error {
app := clihelper.DefaultApp(&cli.App{
Name: "ocis-thumbnails",
Usage: "Example usage",
Before: func(c *cli.Context) error {
return parser.ParseConfig(cfg)
},
Name: "ocis-thumbnails",
Usage: "Example usage",
Commands: GetCommands(cfg),
})

View File

@@ -21,11 +21,8 @@ func Server(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "server",
Usage: "Start integrated server",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
return nil
Before: func(c *cli.Context) error {
return parser.ParseConfig(cfg)
},
Action: func(c *cli.Context) error {
logger := logging.Configure(cfg.Service.Name, cfg.Log)