mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-24 22:49:06 -06:00
ensure, that each config is only parsed once
This commit is contained in:
committed by
Jörn Friedrich Dreyer
parent
5b56920128
commit
1dc63cbce1
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||
"github.com/owncloud/ocis/accounts/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -35,11 +34,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
// Execute is the entry point for the ocis-accounts command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-accounts",
|
||||
Usage: "Provide accounts and groups for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-accounts",
|
||||
Usage: "Provide accounts and groups for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -23,12 +23,8 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start ocis accounts service",
|
||||
Description: "uses an LDAP server as the storage backend",
|
||||
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)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/glauth/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,11 +28,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
// Execute is the entry point for the ocis-glauth command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-glauth",
|
||||
Usage: "Serve GLAuth API for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-glauth",
|
||||
Usage: "Serve GLAuth API for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -24,13 +24,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)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config"
|
||||
"github.com/owncloud/ocis/graph-explorer/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,11 +28,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
// Execute is the entry point for the graph-explorer command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "graph-explorer",
|
||||
Usage: "Serve Graph-Explorer for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "graph-explorer",
|
||||
Usage: "Serve Graph-Explorer for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/graph/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
"github.com/thejerf/suture/v4"
|
||||
|
||||
@@ -30,11 +29,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
// Execute is the entry point for the ocis-graph command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-graph",
|
||||
Usage: "Serve Graph API for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-graph",
|
||||
Usage: "Serve Graph API for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
cli.HelpFlag = &cli.BoolFlag{
|
||||
|
||||
@@ -20,13 +20,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)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/idp/pkg/config"
|
||||
"github.com/owncloud/ocis/idp/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/thejerf/suture/v4"
|
||||
@@ -29,11 +28,8 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
// Execute is the entry point for the ocis-idp command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-idp",
|
||||
Usage: "Serve IDP API for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-idp",
|
||||
Usage: "Serve IDP API for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -20,12 +20,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)
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocs/pkg/config"
|
||||
"github.com/owncloud/ocis/ocs/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-ocs command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-ocs",
|
||||
Usage: "Serve OCS API for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-ocs",
|
||||
Usage: "Serve OCS API for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -21,12 +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)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
"github.com/owncloud/ocis/proxy/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/proxy/pkg/logging"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -14,7 +15,9 @@ func Health(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "health",
|
||||
Usage: "Check health status",
|
||||
//Flags: flagset.HealthWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
"github.com/owncloud/ocis/proxy/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-proxy command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-proxy",
|
||||
Usage: "proxy for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-proxy",
|
||||
Usage: "proxy for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -38,11 +38,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)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/settings/pkg/config"
|
||||
"github.com/owncloud/ocis/settings/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-settings command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-settings",
|
||||
Usage: "Provide settings and permissions for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-settings",
|
||||
Usage: "Provide settings and permissions for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -21,12 +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)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/store/pkg/config"
|
||||
"github.com/owncloud/ocis/store/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-store command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "ocis-store",
|
||||
Usage: "Service to store values for ocis extensions",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "ocis-store",
|
||||
Usage: "Service to store values for ocis extensions",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -21,12 +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)
|
||||
|
||||
@@ -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),
|
||||
})
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/web/pkg/config"
|
||||
"github.com/owncloud/ocis/web/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 web command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "web",
|
||||
Usage: "Serve ownCloud Web for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "web",
|
||||
Usage: "Serve ownCloud Web for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/web/pkg/config"
|
||||
@@ -22,21 +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 cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimRight(cfg.HTTP.Root, "/")
|
||||
}
|
||||
|
||||
if err := parser.ParseConfig(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// build well known openid-configuration endpoint if it is not set
|
||||
if cfg.Web.Config.OpenIDConnect.MetadataURL == "" {
|
||||
cfg.Web.Config.OpenIDConnect.MetadataURL = strings.TrimRight(cfg.Web.Config.OpenIDConnect.Authority, "/") + "/.well-known/openid-configuration"
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -2,6 +2,7 @@ package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/web/pkg/config"
|
||||
@@ -37,6 +38,13 @@ func ParseConfig(cfg *config.Config) error {
|
||||
}
|
||||
|
||||
// sanitize config
|
||||
if cfg.HTTP.Root != "/" {
|
||||
cfg.HTTP.Root = strings.TrimRight(cfg.HTTP.Root, "/")
|
||||
}
|
||||
// build well known openid-configuration endpoint if it is not set
|
||||
if cfg.Web.Config.OpenIDConnect.MetadataURL == "" {
|
||||
cfg.Web.Config.OpenIDConnect.MetadataURL = strings.TrimRight(cfg.Web.Config.OpenIDConnect.Authority, "/") + "/.well-known/openid-configuration"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/owncloud/ocis/ocis-pkg/clihelper"
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/webdav/pkg/config"
|
||||
"github.com/owncloud/ocis/webdav/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-webdav command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "webdav",
|
||||
Usage: "Serve WebDAV API for oCIS",
|
||||
Before: func(c *cli.Context) error {
|
||||
return parser.ParseConfig(cfg)
|
||||
},
|
||||
Name: "webdav",
|
||||
Usage: "Serve WebDAV API for oCIS",
|
||||
Commands: GetCommands(cfg),
|
||||
})
|
||||
|
||||
|
||||
@@ -20,13 +20,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)
|
||||
|
||||
Reference in New Issue
Block a user