MM-58275 Ensure image proxy site URL is updated when that changes (#27214)

* MM-58275 Ensure image proxy site URL is updated when that changes

* Check if proxy settings changed using reflection
Этот коммит содержится в:
Harrison Healey
2024-06-04 14:06:37 -04:00
коммит произвёл GitHub
родитель 206ff6e697
Коммит 2bcaa42dc0
6 изменённых файлов: 127 добавлений и 41 удалений

Просмотреть файл

@@ -11,23 +11,41 @@ import (
type StaticConfigService struct {
Cfg *model.Config
listeners map[string]func(old, current *model.Config)
}
func (s StaticConfigService) Config() *model.Config {
func (s *StaticConfigService) Config() *model.Config {
return s.Cfg
}
func (StaticConfigService) AddConfigListener(func(old, current *model.Config)) string {
return ""
func (s *StaticConfigService) AddConfigListener(listener func(old, current *model.Config)) string {
if s.listeners == nil {
s.listeners = make(map[string]func(old, current *model.Config))
}
listenerID := model.NewId()
s.listeners[listenerID] = listener
return listenerID
}
func (StaticConfigService) RemoveConfigListener(string) {
func (s *StaticConfigService) RemoveConfigListener(listenerID string) {
delete(s.listeners, listenerID)
}
func (StaticConfigService) AsymmetricSigningKey() *ecdsa.PrivateKey {
func (s *StaticConfigService) AsymmetricSigningKey() *ecdsa.PrivateKey {
return &ecdsa.PrivateKey{}
}
func (StaticConfigService) PostActionCookieSecret() []byte {
func (s *StaticConfigService) PostActionCookieSecret() []byte {
return make([]byte, 32)
}
func (s *StaticConfigService) UpdateConfig(newConfig *model.Config) {
oldConfig := s.Config()
s.Cfg = newConfig
for _, listener := range s.listeners {
listener(oldConfig, newConfig)
}
}