fix configuration validation for extensions' server commands

This commit is contained in:
Willy Kloucek committed 2022-06-02 09:57:45 +02:00
1 parent b5bb5ed087
commit 27b2fbe7e0
33 files changed
+47 -32

No files matched your search

@@ -0,0 +1,11 @@
Bugfix: Fix configuration validation for extensions' server commands
We've fixed the configuration validation for the extensions' server commands.
Before that fix error messages have occurred when started services which don't need
certain configuration values, that are needed for the oCIS fullstack command.
We now no longer do the common oCIS configuration validation for extensions' server
commands and now rely only on the extensions' validation function.
https://github.com/owncloud/ocis/pull/3911
+5 -1
View File
@@ -11,7 +11,7 @@ import (
// ParseConfig loads the ocis configuration and // ParseConfig loads the ocis configuration and
// copies applicable parts into the commons part, from // copies applicable parts into the commons part, from
// where the extensions can copy it into their own config // where the extensions can copy it into their own config
func ParseConfig(cfg *config.Config) error { func ParseConfig(cfg *config.Config, skipValidate bool) error {
_, err := config.BindSourcesToStructs("ocis", cfg) _, err := config.BindSourcesToStructs("ocis", cfg)
if err != nil { if err != nil {
return err return err
@@ -29,6 +29,10 @@ func ParseConfig(cfg *config.Config) error {
EnsureCommons(cfg) EnsureCommons(cfg)
if skipValidate {
return nil
}
return Validate(cfg) return Validate(cfg)
} }
+1 -1
View File
@@ -18,7 +18,7 @@ func AppProviderCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.AppProvider.Service.Name), Usage: helper.SubcommandDescription(cfg.AppProvider.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.AppProvider.Commons = cfg.Commons cfg.AppProvider.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func AppRegistryCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.AppRegistry.Service.Name), Usage: helper.SubcommandDescription(cfg.AppRegistry.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.AppRegistry.Commons = cfg.Commons cfg.AppRegistry.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func AuditCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Audit.Service.Name), Usage: helper.SubcommandDescription(cfg.Audit.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Audit.Commons = cfg.Commons cfg.Audit.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func AuthBasicCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.AuthBasic.Service.Name), Usage: helper.SubcommandDescription(cfg.AuthBasic.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.AuthBasic.Commons = cfg.Commons cfg.AuthBasic.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func AuthBearerCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.AuthBearer.Service.Name), Usage: helper.SubcommandDescription(cfg.AuthBearer.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.AuthBearer.Commons = cfg.Commons cfg.AuthBearer.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func AuthMachineCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.AuthMachine.Service.Name), Usage: helper.SubcommandDescription(cfg.AuthMachine.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.AuthMachine.Commons = cfg.Commons cfg.AuthMachine.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func FrontendCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Frontend.Service.Name), Usage: helper.SubcommandDescription(cfg.Frontend.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Frontend.Commons = cfg.Commons cfg.Frontend.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func GatewayCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Gateway.Service.Name), Usage: helper.SubcommandDescription(cfg.Gateway.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Gateway.Commons = cfg.Commons cfg.Gateway.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.GraphExplorer.Service.Name), Usage: helper.SubcommandDescription(cfg.GraphExplorer.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.GraphExplorer.Commons = cfg.Commons cfg.GraphExplorer.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func GraphCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Graph.Service.Name), Usage: helper.SubcommandDescription(cfg.Graph.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Graph.Commons = cfg.Commons cfg.Graph.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func GroupsCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Groups.Service.Name), Usage: helper.SubcommandDescription(cfg.Groups.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Groups.Commons = cfg.Commons cfg.Groups.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func IDMCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.IDM.Service.Name), Usage: helper.SubcommandDescription(cfg.IDM.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.IDM.Commons = cfg.Commons cfg.IDM.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func IDPCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.IDP.Service.Name), Usage: helper.SubcommandDescription(cfg.IDP.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.IDP.Commons = cfg.Commons cfg.IDP.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func NatsCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Nats.Service.Name), Usage: helper.SubcommandDescription(cfg.Nats.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Nats.Commons = cfg.Commons cfg.Nats.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func NotificationsCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Notifications.Service.Name), Usage: helper.SubcommandDescription(cfg.Notifications.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Notifications.Commons = cfg.Commons cfg.Notifications.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func OCDavCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.OCDav.Service.Name), Usage: helper.SubcommandDescription(cfg.OCDav.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.OCDav.Commons = cfg.Commons cfg.OCDav.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func OCSCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.OCS.Service.Name), Usage: helper.SubcommandDescription(cfg.OCS.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.OCS.Commons = cfg.Commons cfg.OCS.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Proxy.Service.Name), Usage: helper.SubcommandDescription(cfg.Proxy.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Proxy.Commons = cfg.Commons cfg.Proxy.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func SearchCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Search.Service.Name), Usage: helper.SubcommandDescription(cfg.Search.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Search.Commons = cfg.Commons cfg.Search.Commons = cfg.Commons
+1 -1
View File
@@ -17,7 +17,7 @@ func Server(cfg *config.Config) *cli.Command {
Usage: "start a fullstack server (runtime and all extensions in supervised mode)", Usage: "start a fullstack server (runtime and all extensions in supervised mode)",
Category: "fullstack", Category: "fullstack",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, false); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
return err return err
} }
+1 -1
View File
@@ -18,7 +18,7 @@ func SettingsCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Settings.Service.Name), Usage: helper.SubcommandDescription(cfg.Settings.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Settings.Commons = cfg.Commons cfg.Settings.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func SharingCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Sharing.Service.Name), Usage: helper.SubcommandDescription(cfg.Sharing.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Sharing.Commons = cfg.Commons cfg.Sharing.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func StoragePublicLinkCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.StoragePublicLink.Service.Name), Usage: helper.SubcommandDescription(cfg.StoragePublicLink.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.StoragePublicLink.Commons = cfg.Commons cfg.StoragePublicLink.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func StorageSharesCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.StorageShares.Service.Name), Usage: helper.SubcommandDescription(cfg.StorageShares.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.StorageShares.Commons = cfg.Commons cfg.StorageShares.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func StorageSystemCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.StorageSystem.Service.Name), Usage: helper.SubcommandDescription(cfg.StorageSystem.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.StorageSystem.Commons = cfg.Commons cfg.StorageSystem.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func StorageUsersCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.StorageUsers.Service.Name), Usage: helper.SubcommandDescription(cfg.StorageUsers.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.StorageUsers.Commons = cfg.Commons cfg.StorageUsers.Commons = cfg.Commons
+1 -1
View File
@@ -19,7 +19,7 @@ func StoreCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Store.Service.Name), Usage: helper.SubcommandDescription(cfg.Store.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Store.Commons = cfg.Commons cfg.Store.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func ThumbnailsCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Thumbnails.Service.Name), Usage: helper.SubcommandDescription(cfg.Thumbnails.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Thumbnails.Commons = cfg.Commons cfg.Thumbnails.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func UsersCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Users.Service.Name), Usage: helper.SubcommandDescription(cfg.Users.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Users.Commons = cfg.Commons cfg.Users.Commons = cfg.Commons
+1 -1
View File
@@ -18,7 +18,7 @@ func WebCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.Web.Service.Name), Usage: helper.SubcommandDescription(cfg.Web.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.Web.Commons = cfg.Commons cfg.Web.Commons = cfg.Commons
+1 -1
View File
@@ -19,7 +19,7 @@ func WebDAVCommand(cfg *config.Config) *cli.Command {
Usage: helper.SubcommandDescription(cfg.WebDAV.Service.Name), Usage: helper.SubcommandDescription(cfg.WebDAV.Service.Name),
Category: "extensions", Category: "extensions",
Before: func(c *cli.Context) error { Before: func(c *cli.Context) error {
if err := parser.ParseConfig(cfg); err != nil { if err := parser.ParseConfig(cfg, true); err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
} }
cfg.WebDAV.Commons = cfg.Commons cfg.WebDAV.Commons = cfg.Commons