mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-22 02:58:02 +02:00
config: fix hot-reloading (#1820)
This commit is contained in:
parent
19d78cb844
commit
979e8f9cec
2 changed files with 22 additions and 15 deletions
|
@ -2,7 +2,6 @@ package config
|
|||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"io/ioutil"
|
||||
"sync"
|
||||
|
||||
|
@ -124,7 +123,6 @@ type FileWatcherSource struct {
|
|||
|
||||
mu sync.RWMutex
|
||||
computedConfig *Config
|
||||
version string
|
||||
|
||||
ChangeDispatcher
|
||||
}
|
||||
|
@ -183,16 +181,11 @@ func (src *FileWatcherSource) check(cfg *Config) {
|
|||
}
|
||||
}
|
||||
|
||||
version := hex.EncodeToString(h.Sum(nil))
|
||||
if src.version != version {
|
||||
src.version = version
|
||||
// update the computed config
|
||||
src.computedConfig = cfg.Clone()
|
||||
src.computedConfig.Options.Certificates = nil
|
||||
_ = src.computedConfig.Options.Validate()
|
||||
|
||||
// update the computed config
|
||||
src.computedConfig = cfg.Clone()
|
||||
src.computedConfig.Options.Certificates = nil
|
||||
_ = src.computedConfig.Options.Validate()
|
||||
|
||||
// trigger a change
|
||||
src.Trigger(src.computedConfig)
|
||||
}
|
||||
// trigger a change
|
||||
src.Trigger(src.computedConfig)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue