Skip to content

Commit

Permalink
further hook up app provider
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek committed Jun 28, 2021
1 parent 2d047a4 commit 270d6b1
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/extensions/storage/ports.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ For now, the storage service uses these ports to preconfigure those services:
| 9159 | storage users debug |
| 9160 | groups |
| 9161 | groups debug |
| 9164 | appprovider |
| 9165 | appprovider debug |
| 9178 | storage public link |
| 9179 | storage public link data |
| 9215 | storage meta grpc |
Expand Down
45 changes: 45 additions & 0 deletions ocis/pkg/command/storageappprovider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// +build !simple

package command

import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/storage/pkg/command"
svcconfig "github.com/owncloud/ocis/storage/pkg/config"
"github.com/owncloud/ocis/storage/pkg/flagset"
)

// StorageAppProviderCommand is the entrypoint for the reva-app-provider command.
func StorageAppProviderCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "storage-app-provider",
Usage: "Start storage app-provider service",
Category: "Extensions",
Flags: flagset.AppProviderWithConfig(cfg.Storage),
Action: func(c *cli.Context) error {
origCmd := command.AppProvider(configureStorageAppProvider(cfg))
return handleOriginalAction(c, origCmd)
},
}
}

func configureStorageAppProvider(cfg *config.Config) *svcconfig.Config {
cfg.Storage.Log.Level = cfg.Log.Level
cfg.Storage.Log.Pretty = cfg.Log.Pretty
cfg.Storage.Log.Color = cfg.Log.Color

if cfg.Tracing.Enabled {
cfg.Storage.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Storage.Tracing.Type = cfg.Tracing.Type
cfg.Storage.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Storage.Tracing.Collector = cfg.Tracing.Collector
}

return cfg.Storage
}

func init() {
register.AddCommand(StorageAppProviderCommand)
}
1 change: 1 addition & 0 deletions ocis/pkg/runtime/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry["storage-home"] = storage.NewStorageHome
s.ServicesRegistry["storage-users"] = storage.NewStorageUsers
s.ServicesRegistry["storage-public-link"] = storage.NewStoragePublicLink
s.ServicesRegistry["storage-appprovider"] = storage.NewAppProvider

// populate delayed services
s.Delayed["storage-sharing"] = storage.NewSharing
Expand Down
1 change: 1 addition & 0 deletions storage/pkg/command/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func appProviderConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
// TODO build services dynamically
"services": map[string]interface{}{
"appprovider": map[string]interface{}{
"driver": cfg.Reva.AppProvider.Driver,
"iopsecret": cfg.Reva.AppProvider.IopSecret,
"wopiurl": cfg.Reva.AppProvider.WopiUrl,
"wopibridgeurl": cfg.Reva.AppProvider.WopiBridgeUrl,
Expand Down
1 change: 1 addition & 0 deletions storage/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type StorageRegistry struct {
// AppProvider defines the available app provider configuration
type AppProvider struct {
Port
Driver string
IopSecret string
WopiUrl string
WopiBridgeUrl string
Expand Down
13 changes: 10 additions & 3 deletions storage/pkg/flagset/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func AppProviderWithConfig(cfg *config.Config) []cli.Flag {
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.DebugAddr, "0.0.0.0:9147"),
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.DebugAddr, "0.0.0.0:9165"),
Usage: "Address to bind debug server",
EnvVars: []string{"APP_PROVIDER_BASIC_DEBUG_ADDR"},
Destination: &cfg.Reva.AppProvider.DebugAddr,
Expand All @@ -34,7 +34,7 @@ func AppProviderWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.GRPCAddr, "0.0.0.0:9146"),
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.GRPCAddr, "0.0.0.0:9164"),
Usage: "Address to bind storage service",
EnvVars: []string{"APP_PROVIDER_BASIC_GRPC_ADDR"},
Destination: &cfg.Reva.AppProvider.GRPCAddr,
Expand All @@ -45,10 +45,17 @@ func AppProviderWithConfig(cfg *config.Config) []cli.Flag {
Usage: "--service appprovider [--service otherservice]",
EnvVars: []string{"APP_PROVIDER_BASIC_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.Driver, "demo"),
Usage: "app provider driver",
EnvVars: []string{"APP_PROVIDER_DRIVER"},
Destination: &cfg.Reva.AppProvider.Driver,
},
&cli.StringFlag{
Name: "iopsecret",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.IopSecret, ""),
Usage: "Iop Secret",
Usage: "IOP Secret (Shared with WOPI server)",
EnvVars: []string{"APP_PROVIDER_IOP_SECRET"},
Destination: &cfg.Reva.AppProvider.IopSecret,
},
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/flagset/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"STORAGE_SHARING_ENDPOINT"},
Destination: &cfg.Reva.Sharing.Endpoint,
},
&cli.StringFlag{
Name: "appprovider-endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.Endpoint, "localhost:9164"),
Usage: "endpoint to use for the app provider",
EnvVars: []string{"STORAGE_APPPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.AppProvider.Endpoint,
},

// register home storage

Expand Down

0 comments on commit 270d6b1

Please sign in to comment.