mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 00:10:45 +02:00
cache: support databroker option changes (#1294)
This commit is contained in:
parent
31205c0c29
commit
a1378c81f8
16 changed files with 408 additions and 179 deletions
|
@ -88,7 +88,7 @@ func Run(ctx context.Context, configFile string) error {
|
|||
}
|
||||
var cacheServer *cache.Cache
|
||||
if config.IsCache(cfg.Options.Services) {
|
||||
cacheServer, err = setupCache(cfg.Options, controlPlane)
|
||||
cacheServer, err = setupCache(src, cfg, controlPlane)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -162,13 +162,15 @@ func setupAuthorize(src config.Source, cfg *config.Config, controlPlane *control
|
|||
return svc, nil
|
||||
}
|
||||
|
||||
func setupCache(opt *config.Options, controlPlane *controlplane.Server) (*cache.Cache, error) {
|
||||
svc, err := cache.New(*opt)
|
||||
func setupCache(src config.Source, cfg *config.Config, controlPlane *controlplane.Server) (*cache.Cache, error) {
|
||||
svc, err := cache.New(cfg)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating config service: %w", err)
|
||||
}
|
||||
svc.Register(controlPlane.GRPCServer)
|
||||
log.Info().Msg("enabled cache service")
|
||||
src.OnConfigChange(svc.OnConfigChange)
|
||||
svc.OnConfigChange(cfg)
|
||||
return svc, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue