Use go-micro store to cache the roles (#4337)
* Use go-micro store to cache the roles Add custom in-memory implementation * replace redis with custom etcd implementation * adjust table name for the cache in the roles manager * Fix tests * Fix sonarcloud issues * Refactor for sonarcloud * Allow configuration of cache per service * Reuse parent context in etcd implementation
This commit is contained in:
@@ -48,6 +48,9 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.TokenManager == nil {
|
||||
cfg.TokenManager = &shared.TokenManager{}
|
||||
}
|
||||
if cfg.CacheStore == nil {
|
||||
cfg.CacheStore = &shared.CacheStore{}
|
||||
}
|
||||
}
|
||||
|
||||
// EnsureCommons copies applicable parts of the oCIS config into the commons part
|
||||
@@ -81,6 +84,16 @@ func EnsureCommons(cfg *config.Config) {
|
||||
cfg.Commons.Tracing = &shared.Tracing{}
|
||||
}
|
||||
|
||||
if cfg.CacheStore != nil {
|
||||
cfg.Commons.CacheStore = &shared.CacheStore{
|
||||
Type: cfg.CacheStore.Type,
|
||||
Address: cfg.CacheStore.Address,
|
||||
Size: cfg.CacheStore.Size,
|
||||
}
|
||||
} else {
|
||||
cfg.Commons.CacheStore = &shared.CacheStore{}
|
||||
}
|
||||
|
||||
// copy token manager to the commons part if set
|
||||
if cfg.TokenManager != nil {
|
||||
cfg.Commons.TokenManager = cfg.TokenManager
|
||||
|
||||
Reference in New Issue
Block a user