mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-24 04:58:31 -05:00
Start proxy with ocis server command #136
This commit is contained in:
committed by
Ilja Neumann
parent
63328c7a40
commit
1e0f04dcbf
@@ -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)
|
||||
}
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ var (
|
||||
"reva-storage-oc-data",
|
||||
"devldap",
|
||||
"konnectd",
|
||||
"proxy",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user