Skip to content

Commit

Permalink
make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek committed Jun 29, 2021
1 parent 270d6b1 commit a3933e3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
12 changes: 3 additions & 9 deletions storage/pkg/command/appprovider.go
Expand Up @@ -5,7 +5,6 @@ import (
"flag"
"os"
"path"
"path/filepath"

"github.com/cs3org/reva/cmd/revad/runtime"
"github.com/gofrs/uuid"
Expand Down Expand Up @@ -38,13 +37,6 @@ func AppProvider(cfg *config.Config) *cli.Command {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

// pre-create folders
if cfg.Reva.AuthProvider.Driver == "json" && cfg.Reva.AuthProvider.JSON != "" {
if err := os.MkdirAll(filepath.Dir(cfg.Reva.AuthProvider.JSON), os.FileMode(0700)); err != nil {
return err
}
}

uuid := uuid.Must(uuid.NewV4())
pidFile := path.Join(os.TempDir(), "revad-"+c.Command.Name+"-"+uuid.String()+".pid")

Expand Down Expand Up @@ -78,7 +70,7 @@ func AppProvider(cfg *config.Config) *cli.Command {
cancel()
})

if !cfg.Reva.StorageMetadata.Supervised {
if !cfg.Reva.AppProvider.Supervised {
sync.Trap(&gr, cancel)
}

Expand Down Expand Up @@ -107,6 +99,8 @@ func appProviderConfigFromStruct(c *cli.Context, cfg *config.Config) map[string]
"services": map[string]interface{}{
"appprovider": map[string]interface{}{
"driver": cfg.Reva.AppProvider.Driver,
"demo": map[string]interface{}{},
"wopiinsecure": cfg.Reva.AppProvider.WopiInsecure,
"iopsecret": cfg.Reva.AppProvider.IopSecret,
"wopiurl": cfg.Reva.AppProvider.WopiUrl,
"wopibridgeurl": cfg.Reva.AppProvider.WopiBridgeUrl,
Expand Down
9 changes: 9 additions & 0 deletions storage/pkg/command/gateway.go
Expand Up @@ -160,6 +160,15 @@ func gatewayConfigFromStruct(c *cli.Context, cfg *config.Config, logger log.Logg
},
},
},
"appregistry": map[string]interface{}{
"driver": "static",
"static": map[string]interface{}{
"rules": map[string]interface{}{
//TODO: add types configuration
"application/vnd.oasis.opendocument.text": cfg.Reva.AppProvider.Endpoint,
},
},
},
"storageregistry": map[string]interface{}{
"driver": cfg.Reva.StorageRegistry.Driver,
"drivers": map[string]interface{}{
Expand Down
1 change: 1 addition & 0 deletions storage/pkg/command/root.go
Expand Up @@ -76,6 +76,7 @@ func Execute(cfg *config.Config) error {
Gateway(cfg),
Users(cfg),
Groups(cfg),
AppProvider(cfg),
AuthBasic(cfg),
AuthBearer(cfg),
Sharing(cfg),
Expand Down
1 change: 1 addition & 0 deletions storage/pkg/config/config.go
Expand Up @@ -44,6 +44,7 @@ type AppProvider struct {
Port
Driver string
IopSecret string
WopiInsecure bool
WopiUrl string
WopiBridgeUrl string
}
Expand Down
7 changes: 7 additions & 0 deletions storage/pkg/flagset/appprovider.go
Expand Up @@ -59,6 +59,13 @@ func AppProviderWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"APP_PROVIDER_IOP_SECRET"},
Destination: &cfg.Reva.AppProvider.IopSecret,
},
&cli.BoolFlag{
Name: "wopiinsecure",
Value: flags.OverrideDefaultBool(cfg.Reva.AppProvider.WopiInsecure, false),
Usage: "Disable SSL certificate verification of WOPI server and WOPI bridge",
EnvVars: []string{"APP_PROVIDER_WOPI_INSECURE"},
Destination: &cfg.Reva.AppProvider.WopiInsecure,
},
&cli.StringFlag{
Name: "wopiurl",
Value: flags.OverrideDefaultString(cfg.Reva.AppProvider.WopiUrl, ""),
Expand Down
2 changes: 1 addition & 1 deletion storage/pkg/flagset/gateway.go
Expand Up @@ -62,7 +62,7 @@ func GatewayWithConfig(cfg *config.Config) []cli.Flag {
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("gateway", "authregistry", "storageregistry"), // TODO appregistry
Value: cli.NewStringSlice("gateway", "authregistry", "storageregistry", "appregistry"),
Usage: "--service gateway [--service authregistry]",
EnvVars: []string{"STORAGE_GATEWAY_SERVICES"},
},
Expand Down

0 comments on commit a3933e3

Please sign in to comment.