Start proxy with ocis server command #136

This commit is contained in:
Ilja Neumann
2020-03-11 19:29:37 +01:00
committed by Ilja Neumann
parent 63328c7a40
commit 1e0f04dcbf
6 changed files with 81 additions and 4 deletions
+42
View File
@@ -0,0 +1,42 @@
package command
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-proxy/pkg/command"
svcconfig "github.com/owncloud/ocis-proxy/pkg/config"
"github.com/owncloud/ocis-proxy/pkg/flagset"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
)
// ProxyCommand is the entry point for the proxy command.
func ProxyCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "proxy",
Usage: "Start proxy server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.Proxy),
Action: func(c *cli.Context) error {
serverConfig := configureProxy(cfg)
serverCommand := command.Server(serverConfig)
if err := serverCommand.Before(c); err != nil {
return err
}
return cli.HandleAction(serverCommand.Action, c)
},
}
}
func configureProxy(cfg *config.Config) *svcconfig.Config {
cfg.Proxy.Log.Level = cfg.Log.Level
cfg.Proxy.Log.Pretty = cfg.Log.Pretty
cfg.Proxy.Log.Color = cfg.Log.Color
return cfg.Proxy
}
func init() {
register.AddCommand(ProxyCommand)
}
+3
View File
@@ -8,6 +8,7 @@ import (
konnectd "github.com/owncloud/ocis-konnectd/pkg/config"
ocs "github.com/owncloud/ocis-ocs/pkg/config"
phoenix "github.com/owncloud/ocis-phoenix/pkg/config"
proxy "github.com/owncloud/ocis-proxy/pkg/config"
reva "github.com/owncloud/ocis-reva/pkg/config"
webdav "github.com/owncloud/ocis-webdav/pkg/config"
)
@@ -65,6 +66,7 @@ type Config struct {
WebDAV *webdav.Config
Reva *reva.Config
DevLDAP *devldap.Config
Proxy *proxy.Config
}
// New initializes a new configuration with or without defaults.
@@ -79,5 +81,6 @@ func New() *Config {
WebDAV: webdav.New(),
Reva: reva.New(),
DevLDAP: devldap.New(),
Proxy: proxy.New(),
}
}
+1
View File
@@ -49,6 +49,7 @@ var (
"reva-storage-oc-data",
"devldap",
"konnectd",
"proxy",
}
)