Remove redundant object-store in federation
This commit is contained in:
parent
6aab216f89
commit
e9d1d9cc3f
@ -7,12 +7,8 @@ import (
|
||||
cs "github.com/cortezaproject/corteza-server/compose/service"
|
||||
"github.com/cortezaproject/corteza-server/pkg/actionlog"
|
||||
"github.com/cortezaproject/corteza-server/pkg/auth"
|
||||
"github.com/cortezaproject/corteza-server/pkg/healthcheck"
|
||||
"github.com/cortezaproject/corteza-server/pkg/id"
|
||||
"github.com/cortezaproject/corteza-server/pkg/label"
|
||||
"github.com/cortezaproject/corteza-server/pkg/objstore"
|
||||
"github.com/cortezaproject/corteza-server/pkg/objstore/minio"
|
||||
"github.com/cortezaproject/corteza-server/pkg/objstore/plain"
|
||||
"github.com/cortezaproject/corteza-server/pkg/options"
|
||||
"github.com/cortezaproject/corteza-server/pkg/rbac"
|
||||
"github.com/cortezaproject/corteza-server/store"
|
||||
@ -31,11 +27,6 @@ type (
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultObjectStore objstore.Store
|
||||
|
||||
// DefaultNgStore is an interface to storage backend(s)
|
||||
// ng (next-gen) is a temporary prefix
|
||||
// so that we can differentiate between it and the file-only store
|
||||
DefaultStore store.Storer
|
||||
|
||||
DefaultLogger *zap.Logger
|
||||
@ -68,10 +59,6 @@ var (
|
||||
)
|
||||
|
||||
func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config) (err error) {
|
||||
var (
|
||||
hcd = healthcheck.Defaults()
|
||||
)
|
||||
|
||||
DefaultOptions = c.Federation
|
||||
|
||||
// we're doing conversion to avoid having
|
||||
@ -80,6 +67,8 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
|
||||
|
||||
DefaultLogger = log.Named("service")
|
||||
|
||||
// @todo add healthcheck(s) for federation sync services
|
||||
|
||||
{
|
||||
tee := zap.NewNop()
|
||||
policy := actionlog.MakeProductionPolicy()
|
||||
@ -96,43 +85,6 @@ func Initialize(ctx context.Context, log *zap.Logger, s store.Storer, c Config)
|
||||
|
||||
DefaultAccessControl = AccessControl(rbac.Global())
|
||||
|
||||
if DefaultStore == nil {
|
||||
const svcPath = "federation"
|
||||
if c.Storage.MinioEndpoint != "" {
|
||||
var bucket = svcPath
|
||||
if c.Storage.MinioBucket != "" {
|
||||
bucket = c.Storage.MinioBucket + "/" + svcPath
|
||||
}
|
||||
|
||||
DefaultObjectStore, err = minio.New(bucket, minio.Options{
|
||||
Endpoint: c.Storage.MinioEndpoint,
|
||||
Secure: c.Storage.MinioSecure,
|
||||
Strict: c.Storage.MinioStrict,
|
||||
AccessKeyID: c.Storage.MinioAccessKey,
|
||||
SecretAccessKey: c.Storage.MinioSecretKey,
|
||||
|
||||
ServerSideEncryptKey: []byte(c.Storage.MinioSSECKey),
|
||||
})
|
||||
|
||||
log.Info("initializing minio",
|
||||
zap.String("bucket", bucket),
|
||||
zap.String("endpoint", c.Storage.MinioEndpoint),
|
||||
zap.Error(err))
|
||||
} else {
|
||||
path := c.Storage.Path + "/" + svcPath
|
||||
DefaultObjectStore, err = plain.New(path)
|
||||
log.Info("initializing store",
|
||||
zap.String("path", path),
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
hcd.Add(objstore.Healthcheck(DefaultObjectStore), "Store/Federation")
|
||||
|
||||
DefaultNode = Node(DefaultStore, service.DefaultUser, DefaultActionlog, auth.DefaultJwtHandler, c.Federation, DefaultAccessControl)
|
||||
DefaultNodeSync = NodeSync()
|
||||
DefaultExposedModule = ExposedModule()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user