mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-06 07:03:11 -04:00
Fix store command
- Was started with the wrong flagset - Didn't use the ocis-store config at all
This commit is contained in:
committed by
Artur Neumann
parent
75e9506254
commit
1b048da76a
@@ -3,15 +3,10 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/micro/go-micro/v2"
|
||||
gostore "github.com/micro/go-micro/v2/store"
|
||||
"github.com/micro/go-micro/v2/store/file"
|
||||
"github.com/owncloud/ocis-ocs/pkg/flagset"
|
||||
"github.com/owncloud/ocis-store/pkg/command"
|
||||
svcconfig "github.com/owncloud/ocis-store/pkg/config"
|
||||
"github.com/owncloud/ocis-store/pkg/flagset"
|
||||
"github.com/owncloud/ocis/pkg/config"
|
||||
"github.com/owncloud/ocis/pkg/register"
|
||||
)
|
||||
@@ -22,37 +17,27 @@ func StoreCommand(cfg *config.Config) *cli.Command {
|
||||
Name: "store",
|
||||
Usage: "Start a go-micro store",
|
||||
Category: "Runtime",
|
||||
Flags: flagset.ServerWithConfig(cfg.OCS),
|
||||
Flags: flagset.ServerWithConfig(cfg.Store),
|
||||
Action: func(ctx *cli.Context) error {
|
||||
file.DefaultDir = "/var/tmp/ocis/store"
|
||||
store := file.NewStore(
|
||||
gostore.Database("ocis"),
|
||||
gostore.Table("ocis"),
|
||||
gostore.WithContext(context.Background()),
|
||||
)
|
||||
storeCommand := command.Server(configureStore(cfg))
|
||||
|
||||
mopts := []micro.Option{
|
||||
micro.Name(
|
||||
strings.Join(
|
||||
[]string{
|
||||
"com.owncloud",
|
||||
"store",
|
||||
},
|
||||
".",
|
||||
),
|
||||
),
|
||||
micro.RegisterTTL(time.Second * 30),
|
||||
micro.RegisterInterval(time.Second * 10),
|
||||
micro.Store(store),
|
||||
if err := storeCommand.Before(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
service := micro.NewService(mopts...)
|
||||
service.Init()
|
||||
return service.Run()
|
||||
return cli.HandleAction(storeCommand.Action, ctx)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configureStore(cfg *config.Config) *svcconfig.Config {
|
||||
cfg.Store.Log.Level = cfg.Log.Level
|
||||
cfg.Store.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Store.Log.Color = cfg.Log.Color
|
||||
|
||||
return cfg.Store
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(StoreCommand)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
proxy "github.com/owncloud/ocis-proxy/pkg/config"
|
||||
reva "github.com/owncloud/ocis-reva/pkg/config"
|
||||
settings "github.com/owncloud/ocis-settings/pkg/config"
|
||||
store "github.com/owncloud/ocis-store/pkg/config"
|
||||
thumbnails "github.com/owncloud/ocis-thumbnails/pkg/config"
|
||||
webdav "github.com/owncloud/ocis-webdav/pkg/config"
|
||||
pman "github.com/refs/pman/pkg/config"
|
||||
@@ -74,6 +75,7 @@ type Config struct {
|
||||
Thumbnails *thumbnails.Config
|
||||
WebDAV *webdav.Config
|
||||
Settings *settings.Config
|
||||
Store *store.Config
|
||||
Runtime *pman.Config
|
||||
}
|
||||
|
||||
@@ -93,6 +95,7 @@ func New() *Config {
|
||||
Proxy: proxy.New(),
|
||||
Thumbnails: thumbnails.New(),
|
||||
Settings: settings.New(),
|
||||
Store: store.New(),
|
||||
Runtime: pman.NewConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ var (
|
||||
// Extensions are ocis extension services
|
||||
Extensions = []string{
|
||||
"proxy",
|
||||
"store",
|
||||
"settings",
|
||||
"phoenix",
|
||||
"graph",
|
||||
|
||||
Reference in New Issue
Block a user