diff --git a/accounts/pkg/indexer/index/cs3/unique.go b/accounts/pkg/indexer/index/cs3/unique.go index a804d736cf..35d8d5983d 100644 --- a/accounts/pkg/indexer/index/cs3/unique.go +++ b/accounts/pkg/indexer/index/cs3/unique.go @@ -64,7 +64,12 @@ func NewUniqueIndexWithOptions(o ...option.Option) index.Index { indexBaseDir: path.Join(opts.DataDir, "index.cs3"), indexRootDir: path.Join(path.Join(opts.DataDir, "index.cs3"), strings.Join([]string{"unique", opts.TypeName, opts.IndexBy}, ".")), cs3conf: &Config{ - JWTSecret: opts.JWTSecret, + ProviderAddr: opts.ProviderAddr, + DataURL: opts.DataURL, + DataPrefix: opts.DataPrefix, + JWTSecret: opts.JWTSecret, + ServiceUserName: "", + ServiceUserUUID: "", }, dataProvider: dataProviderClient{ baseURL: singleJoiningSlash(opts.DataURL, opts.DataPrefix), diff --git a/accounts/pkg/indexer/indexer.go b/accounts/pkg/indexer/indexer.go index 7110f8ec76..217e9389da 100644 --- a/accounts/pkg/indexer/indexer.go +++ b/accounts/pkg/indexer/indexer.go @@ -68,6 +68,7 @@ func (i Indexer) AddUniqueIndex(t interface{}, indexBy, pkName, entityDirName st option.WithDataURL(i.newConfig.Repo.CS3.DataURL), option.WithDataPrefix(i.newConfig.Repo.CS3.DataPrefix), option.WithJWTSecret(i.newConfig.Repo.CS3.JWTSecret), + option.WithProviderAddr(i.newConfig.Repo.CS3.ProviderAddr), ) } diff --git a/accounts/pkg/indexer/indexer_test.go b/accounts/pkg/indexer/indexer_test.go index a213fab0dd..cdb42bed3f 100644 --- a/accounts/pkg/indexer/indexer_test.go +++ b/accounts/pkg/indexer/indexer_test.go @@ -7,6 +7,7 @@ import ( . "github.com/owncloud/ocis/accounts/pkg/indexer/test" "github.com/rs/zerolog" "github.com/stretchr/testify/assert" + "os" "testing" ) @@ -28,7 +29,7 @@ func TestIndexer_AddWithUniqueIndex(t *testing.T) { } func TestIndexer_AddWithUniqueIndexCS3(t *testing.T) { - _ = WriteIndexTestDataCS3(t, TestData, "Id") + dataDir := WriteIndexTestDataCS3(t, TestData, "Id") indexer := CreateIndexer(&config.Config{ Repo: config.Repo{ CS3: config.CS3{ @@ -46,7 +47,7 @@ func TestIndexer_AddWithUniqueIndexCS3(t *testing.T) { err := indexer.Add(u) assert.NoError(t, err) - //_ = os.RemoveAll(dataDir) + _ = os.RemoveAll(dataDir) } func TestIndexer_FindByWithUniqueIndex(t *testing.T) { diff --git a/accounts/pkg/indexer/option/option.go b/accounts/pkg/indexer/option/option.go index aa6a8f42b0..6ee1b958d7 100644 --- a/accounts/pkg/indexer/option/option.go +++ b/accounts/pkg/indexer/option/option.go @@ -14,9 +14,10 @@ type Options struct { EntityDirName string // CS3 options - DataURL string - DataPrefix string - JWTSecret string + DataURL string + DataPrefix string + JWTSecret string + ProviderAddr string } // newOptions initializes the available default options. @@ -83,3 +84,8 @@ func WithFilesDir(val string) Option { o.FilesDir = val } } +func WithProviderAddr(val string) Option { + return func(o *Options) { + o.ProviderAddr = val + } +}