mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
* feat(authz): add openfga authz middleware * feat(authz): update the auth context * feat(authz): update the auth context * feat(authz): update check request * feat(authz): update check request * feat(authz): add lifecycle tests * feat(authz): add lifecycle tests * feat(authz): add start-stop tests
23 lines
853 B
Go
23 lines
853 B
Go
package openfgaauthz
|
|
|
|
import (
|
|
"github.com/SigNoz/signoz/pkg/errors"
|
|
"github.com/SigNoz/signoz/pkg/sqlstore"
|
|
"github.com/openfga/openfga/pkg/storage"
|
|
"github.com/openfga/openfga/pkg/storage/postgres"
|
|
"github.com/openfga/openfga/pkg/storage/sqlcommon"
|
|
)
|
|
|
|
func NewSQLStore(sqlstore sqlstore.SQLStore) (storage.OpenFGADatastore, error) {
|
|
switch sqlstore.BunDB().Dialect().Name().String() {
|
|
// use the NewWithDB for sqlite once https://github.com/openfga/openfga/pull/2679 is merged and released else will figure out something else.
|
|
case "sqlite":
|
|
case "pg":
|
|
return postgres.NewWithDB(sqlstore.SQLDB(), nil, &sqlcommon.Config{
|
|
MaxTuplesPerWriteField: 100,
|
|
MaxTypesPerModelField: 100,
|
|
})
|
|
}
|
|
return nil, errors.Newf(errors.TypeInvalidInput, errors.CodeInvalidInput, "invalid store type: %s", sqlstore.BunDB().Dialect().Name().String())
|
|
}
|