mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-18 17:18:16 +02:00
use context
This commit is contained in:
parent
d1350f0447
commit
328d2d500b
3 changed files with 24 additions and 24 deletions
|
@ -21,7 +21,6 @@ import (
|
|||
type ChangeListener = func(context.Context, *Config)
|
||||
|
||||
type changeDispatcherEvent struct {
|
||||
ctx context.Context
|
||||
cfg *Config
|
||||
}
|
||||
|
||||
|
@ -32,16 +31,15 @@ type ChangeDispatcher struct {
|
|||
|
||||
// Trigger triggers a change.
|
||||
func (dispatcher *ChangeDispatcher) Trigger(ctx context.Context, cfg *Config) {
|
||||
dispatcher.target.Dispatch(changeDispatcherEvent{
|
||||
ctx: ctx,
|
||||
dispatcher.target.Dispatch(ctx, changeDispatcherEvent{
|
||||
cfg: cfg,
|
||||
})
|
||||
}
|
||||
|
||||
// OnConfigChange adds a listener.
|
||||
func (dispatcher *ChangeDispatcher) OnConfigChange(_ context.Context, li ChangeListener) {
|
||||
dispatcher.target.AddListener(func(evt changeDispatcherEvent) {
|
||||
li(evt.ctx, evt.cfg)
|
||||
dispatcher.target.AddListener(func(ctx context.Context, evt changeDispatcherEvent) {
|
||||
li(ctx, evt.cfg)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue