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"),
|
indexBaseDir: path.Join(opts.DataDir, "index.cs3"),
|
||||||
indexRootDir: path.Join(path.Join(opts.DataDir, "index.cs3"), strings.Join([]string{"unique", opts.TypeName, opts.IndexBy}, ".")),
|
indexRootDir: path.Join(path.Join(opts.DataDir, "index.cs3"), strings.Join([]string{"unique", opts.TypeName, opts.IndexBy}, ".")),
|
||||||
cs3conf: &Config{
|
cs3conf: &Config{
|
||||||
JWTSecret: opts.JWTSecret,
|
ProviderAddr: opts.ProviderAddr,
|
||||||
|
DataURL: opts.DataURL,
|
||||||
|
DataPrefix: opts.DataPrefix,
|
||||||
|
JWTSecret: opts.JWTSecret,
|
||||||
|
ServiceUserName: "",
|
||||||
|
ServiceUserUUID: "",
|
||||||
},
|
},
|
||||||
dataProvider: dataProviderClient{
|
dataProvider: dataProviderClient{
|
||||||
baseURL: singleJoiningSlash(opts.DataURL, opts.DataPrefix),
|
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.WithDataURL(i.newConfig.Repo.CS3.DataURL),
|
||||||
option.WithDataPrefix(i.newConfig.Repo.CS3.DataPrefix),
|
option.WithDataPrefix(i.newConfig.Repo.CS3.DataPrefix),
|
||||||
option.WithJWTSecret(i.newConfig.Repo.CS3.JWTSecret),
|
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/owncloud/ocis/accounts/pkg/indexer/test"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ func TestIndexer_AddWithUniqueIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIndexer_AddWithUniqueIndexCS3(t *testing.T) {
|
func TestIndexer_AddWithUniqueIndexCS3(t *testing.T) {
|
||||||
_ = WriteIndexTestDataCS3(t, TestData, "Id")
|
dataDir := WriteIndexTestDataCS3(t, TestData, "Id")
|
||||||
indexer := CreateIndexer(&config.Config{
|
indexer := CreateIndexer(&config.Config{
|
||||||
Repo: config.Repo{
|
Repo: config.Repo{
|
||||||
CS3: config.CS3{
|
CS3: config.CS3{
|
||||||
@@ -46,7 +47,7 @@ func TestIndexer_AddWithUniqueIndexCS3(t *testing.T) {
|
|||||||
err := indexer.Add(u)
|
err := indexer.Add(u)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
//_ = os.RemoveAll(dataDir)
|
_ = os.RemoveAll(dataDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIndexer_FindByWithUniqueIndex(t *testing.T) {
|
func TestIndexer_FindByWithUniqueIndex(t *testing.T) {
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ type Options struct {
|
|||||||
EntityDirName string
|
EntityDirName string
|
||||||
|
|
||||||
// CS3 options
|
// CS3 options
|
||||||
DataURL string
|
DataURL string
|
||||||
DataPrefix string
|
DataPrefix string
|
||||||
JWTSecret string
|
JWTSecret string
|
||||||
|
ProviderAddr string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newOptions initializes the available default options.
|
// newOptions initializes the available default options.
|
||||||
@@ -83,3 +84,8 @@ func WithFilesDir(val string) Option {
|
|||||||
o.FilesDir = val
|
o.FilesDir = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func WithProviderAddr(val string) Option {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.ProviderAddr = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user