func (src *StaticSource) SetConfig(ctx context.Context, cfg *Config) {
	src.mu.Lock()
	defer src.mu.Unlock()
	src.cfg = cfg
	for _, li := range src.lis {
		li(ctx, cfg)
	}
}
SetConfig sets the config.
package config
import (
	"context"
	"crypto/sha256"
	"io/ioutil"
	"sync"
	"github.com/fsnotify/fsnotify"
	"github.com/google/uuid"
	"github.com/rs/zerolog"
	"github.com/pomerium/pomerium/internal/fileutil"
	"github.com/pomerium/pomerium/internal/log"
	"github.com/pomerium/pomerium/internal/netutil"
	"github.com/pomerium/pomerium/internal/telemetry/metrics"
)
type ChangeListener = func(context.Context, *Config)
type ChangeDispatcher struct {
	sync.Mutex
	onConfigChangeListeners []ChangeListener
}
func (dispatcher *ChangeDispatcher) Trigger(ctx context.Context, cfg *Config) {
	dispatcher.Lock()
	defer dispatcher.Unlock()
	for _, li := range dispatcher.onConfigChangeListeners {
		li(ctx, cfg)
	}
}
func (dispatcher *ChangeDispatcher) OnConfigChange(ctx context.Context, li ChangeListener) {
	dispatcher.Lock()
	defer dispatcher.Unlock()
	dispatcher.onConfigChangeListeners = append(dispatcher.onConfigChangeListeners, li)
}
type Source interface {
	GetConfig() *Config
	OnConfigChange(context.Context, ChangeListener)
}
type StaticSource struct {
	mu  sync.Mutex
	cfg *Config
	lis []ChangeListener
}
func NewStaticSource(cfg *Config) *StaticSource {
	return &StaticSource{cfg: cfg}
}
func (src *StaticSource) GetConfig() *Config {
	src.mu.Lock()
	defer src.mu.Unlock()
	return src.cfg
}