support periodically cleaning up expired tokens
This commit is contained in:
@@ -252,6 +252,9 @@ type Config struct {
|
||||
DuplicateSubmissionsInterval uint32
|
||||
DuplicateSubmissionsIntervalDuration time.Duration
|
||||
|
||||
// Cron
|
||||
EnableRemoveExpiredTokens bool
|
||||
|
||||
// Secret
|
||||
SecretKeyNoSet bool
|
||||
SecretKey string
|
||||
@@ -373,6 +376,12 @@ func LoadConfiguration(configFilePath string) (*Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = loadCronConfiguration(config, cfgFile, "cron")
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = loadSecurityConfiguration(config, cfgFile, "security")
|
||||
|
||||
if err != nil {
|
||||
@@ -674,6 +683,12 @@ func loadDuplicateCheckerConfiguration(config *Config, configFile *ini.File, sec
|
||||
return nil
|
||||
}
|
||||
|
||||
func loadCronConfiguration(config *Config, configFile *ini.File, sectionName string) error {
|
||||
config.EnableRemoveExpiredTokens = getConfigItemBoolValue(configFile, sectionName, "enable_remove_expired_tokens", false)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func loadSecurityConfiguration(config *Config, configFile *ini.File, sectionName string) error {
|
||||
config.SecretKeyNoSet = !getConfigItemIsSet(configFile, sectionName, "secret_key")
|
||||
config.SecretKey = getConfigItemStringValue(configFile, sectionName, "secret_key", defaultSecretKey)
|
||||
|
||||
Reference in New Issue
Block a user