mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:04:02 +03:00
Propagate DcUpdateEach setting
This commit is contained in:
@@ -263,6 +263,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
|
||||
AllowFallbackOnUnknownDC: conf.AllowFallbackOnUnknownDC.Get(false),
|
||||
TolerateTimeSkewness: conf.TolerateTimeSkewness.Value,
|
||||
DCOverrides: dcOverrides,
|
||||
DCUpdateEach: conf.DCUpdateEach.Get(0),
|
||||
}
|
||||
|
||||
proxy, err := mtglib.NewProxy(opts)
|
||||
|
||||
@@ -80,6 +80,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
|
||||
conf.Debug.Value = s.Debug
|
||||
conf.AllowFallbackOnUnknownDC.Value = true
|
||||
conf.Defense.AntiReplay.Enabled.Value = true
|
||||
conf.DCUpdateEach.Value = 0
|
||||
|
||||
if err := conf.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid result configuration: %w", err)
|
||||
|
||||
@@ -65,9 +65,10 @@ type Config struct {
|
||||
} `json:"prometheus"`
|
||||
} `json:"stats"`
|
||||
DCOverrides []struct {
|
||||
DC TypeDC
|
||||
DC TypeDC `json:"dc"`
|
||||
IPs []TypeHostPort `json:"ips"`
|
||||
} `json:"dc_overrides"`
|
||||
} `json:"dcOverrides"`
|
||||
DCUpdateEach TypeDuration `json:"dcUpdateEach"`
|
||||
}
|
||||
|
||||
func (c *Config) Validate() error {
|
||||
|
||||
@@ -62,7 +62,8 @@ type tomlConfig struct {
|
||||
DCOverrides []struct {
|
||||
DC int `toml:"dc" json:"dc"`
|
||||
IPs []string `toml:"ips" json:"ips"`
|
||||
}
|
||||
} `toml:"dc-overrides" json:"dcOverrides,omitempty"`
|
||||
DCUpdateEach string `toml:"dc-update-each" json:"dcUpdateEach,omitempty"`
|
||||
}
|
||||
|
||||
func Parse(rawData []byte) (*Config, error) {
|
||||
|
||||
Reference in New Issue
Block a user