ensure, that each config is only parsed once

This commit is contained in:
Willy Kloucek
2022-01-03 19:08:11 +01:00
committed by Jörn Friedrich Dreyer
parent 5b56920128
commit 1dc63cbce1
38 changed files with 70 additions and 262 deletions
+1 -9
View File
@@ -15,15 +15,7 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
Usage: "Start accounts server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Accounts.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Accounts),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func GLAuthCommand(cfg *config.Config) *cli.Command {
Usage: "Start glauth server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.GLAuth.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.GLAuth),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func GraphCommand(cfg *config.Config) *cli.Command {
Usage: "Start graph server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Accounts.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Graph),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
Usage: "Start graph-explorer server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.GraphExplorer.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.GraphExplorer),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func IDPCommand(cfg *config.Config) *cli.Command {
Usage: "Start idp server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.IDP.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.IDP),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func OCSCommand(cfg *config.Config) *cli.Command {
Usage: "Start ocs server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.OCS.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.OCS),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
Usage: "Start proxy server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Proxy.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Proxy),
}
-4
View File
@@ -5,7 +5,6 @@ import (
"github.com/owncloud/ocis/ocis-pkg/clihelper"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/urfave/cli/v2"
)
@@ -17,9 +16,6 @@ func Execute() error {
app := clihelper.DefaultApp(&cli.App{
Name: "ocis",
Usage: "ownCloud Infinite Scale Stack",
Before: func(c *cli.Context) error {
return parser.ParseConfig(cfg)
},
})
for _, fn := range register.Commands {
+1 -9
View File
@@ -15,15 +15,7 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
Usage: "Start settings server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Settings.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Settings),
}
+1 -9
View File
@@ -16,15 +16,7 @@ func StoreCommand(cfg *config.Config) *cli.Command {
Usage: "Start a go-micro store",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Store.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Store),
}
+1 -9
View File
@@ -15,15 +15,7 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command {
Usage: "Start thumbnails server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Thumbnails.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Server(cfg.Thumbnails)
+1 -9
View File
@@ -15,15 +15,7 @@ func WebCommand(cfg *config.Config) *cli.Command {
Usage: "Start web server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.Web.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.Web),
}
+1 -9
View File
@@ -16,15 +16,7 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
Usage: "Start webdav server",
Category: "Extensions",
Before: func(ctx *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil {
return err
}
if cfg.Commons != nil {
cfg.WebDAV.Commons = cfg.Commons
}
return nil
return parser.ParseConfig(cfg)
},
Subcommands: command.GetCommands(cfg.WebDAV),
}