2026-05-20 07:01:08 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
// Config is member module settings (embedded in gateway root config).
|
2026-05-20 07:14:44 +00:00
|
|
|
type Config struct {
|
2026-05-20 07:01:08 +00:00
|
|
|
OTP OTPConfig `json:",optional"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type OTPConfig struct {
|
|
|
|
|
Length int `json:",optional"`
|
|
|
|
|
TTLSeconds int `json:",optional"`
|
|
|
|
|
MaxAttempts int `json:",optional"`
|
|
|
|
|
ResendCooldownSeconds int `json:",optional"`
|
|
|
|
|
DailyVerifyLimit int `json:",optional"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Defaults returns zero-value-safe defaults.
|
|
|
|
|
func (c Config) Defaults() Config {
|
|
|
|
|
if c.OTP.Length <= 0 {
|
|
|
|
|
c.OTP.Length = 6
|
|
|
|
|
}
|
|
|
|
|
if c.OTP.TTLSeconds <= 0 {
|
|
|
|
|
c.OTP.TTLSeconds = 300
|
|
|
|
|
}
|
|
|
|
|
if c.OTP.MaxAttempts <= 0 {
|
|
|
|
|
c.OTP.MaxAttempts = 5
|
|
|
|
|
}
|
|
|
|
|
if c.OTP.ResendCooldownSeconds <= 0 {
|
|
|
|
|
c.OTP.ResendCooldownSeconds = 60
|
|
|
|
|
}
|
|
|
|
|
if c.OTP.DailyVerifyLimit <= 0 {
|
|
|
|
|
c.OTP.DailyVerifyLimit = 10
|
|
|
|
|
}
|
|
|
|
|
return c
|
|
|
|
|
}
|