Skip to content

Commit

Permalink
Feat: add MaxQuoteAge to api config
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasse committed Jul 30, 2024
1 parent f622b71 commit 399fd60
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions services/rfq/api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Config struct {
Bridges map[uint32]string `yaml:"bridges"`
Port string `yaml:"port"`
RelayAckTimeout time.Duration `yaml:"relay_ack_timeout"`
MaxQuoteAge time.Duration `yaml:"max_quote_age"`
}

const defaultRelayAckTimeout = 30 * time.Second
Expand All @@ -37,6 +38,16 @@ func (c Config) GetRelayAckTimeout() time.Duration {
return c.RelayAckTimeout
}

const defaultMaxQuoteAge = 1 * time.Hour

// GetMaxQuoteAge returns the max quote age.
func (c Config) GetMaxQuoteAge() time.Duration {
if c.MaxQuoteAge == 0 {
return defaultMaxQuoteAge
}
return c.MaxQuoteAge
}

// LoadConfig loads the config from the given path.
func LoadConfig(path string) (config Config, err error) {
input, err := os.ReadFile(filepath.Clean(path))
Expand Down

0 comments on commit 399fd60

Please sign in to comment.