mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-04 14:13:18 -04:00
Apply ProviderAddr from options to cs3config
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user