add thumbnails command
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/command"
|
||||
"github.com/owncloud/ocis-thumbnails/pkg/flagset"
|
||||
"github.com/owncloud/ocis/pkg/config"
|
||||
"github.com/owncloud/ocis/pkg/register"
|
||||
|
||||
svcconfig "github.com/owncloud/ocis-thumbnails/pkg/config"
|
||||
)
|
||||
|
||||
// ThumbnailsCommand is the entrypoint for the thumbnails command.
|
||||
func ThumbnailsCommand(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "thumbnails",
|
||||
Usage: "Start thumbnails server",
|
||||
Category: "Extensions",
|
||||
Flags: flagset.ServerWithConfig(cfg.Thumbnails),
|
||||
Action: func(c *cli.Context) error {
|
||||
thumbnailsCommand := command.Server(configureThumbnails(cfg))
|
||||
|
||||
if err := thumbnailsCommand.Before(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return cli.HandleAction(thumbnailsCommand.Action, c)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureThumbnails(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Thumbnails.Log.Level = cfg.Log.Level
|
||||
cfg.Thumbnails.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Thumbnails.Log.Color = cfg.Log.Color
|
||||
|
||||
return cfg.Thumbnails
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(ThumbnailsCommand)
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
phoenix "github.com/owncloud/ocis-phoenix/pkg/config"
|
||||
proxy "github.com/owncloud/ocis-proxy/pkg/config"
|
||||
reva "github.com/owncloud/ocis-reva/pkg/config"
|
||||
thumbnails "github.com/owncloud/ocis-thumbnails/pkg/config"
|
||||
webdav "github.com/owncloud/ocis-webdav/pkg/config"
|
||||
)
|
||||
|
||||
@@ -67,6 +68,7 @@ type Config struct {
|
||||
Reva *reva.Config
|
||||
GLAuth *glauth.Config
|
||||
Proxy *proxy.Config
|
||||
Thumbnails *thumbnails.Config
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
@@ -82,5 +84,6 @@ func New() *Config {
|
||||
Reva: reva.New(),
|
||||
GLAuth: glauth.New(),
|
||||
Proxy: proxy.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ var (
|
||||
"glauth",
|
||||
"konnectd",
|
||||
"proxy", // TODO rename this command. It collides with micro's `proxy`
|
||||
"thumbnails",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user