Add SMSFactor

This commit is contained in:
2023-03-13 00:26:36 +01:00
parent 85fe50f3b4
commit 65bcc8b451
5 changed files with 104 additions and 9 deletions

View File

@@ -120,15 +120,16 @@ stat:
// ConfYaml is config structure.
type ConfYaml struct {
Core SectionCore `yaml:"core"`
API SectionAPI `yaml:"api"`
Android SectionAndroid `yaml:"android"`
Huawei SectionHuawei `yaml:"huawei"`
Ios SectionIos `yaml:"ios"`
Queue SectionQueue `yaml:"queue"`
Log SectionLog `yaml:"log"`
Stat SectionStat `yaml:"stat"`
GRPC SectionGRPC `yaml:"grpc"`
Core SectionCore `yaml:"core"`
API SectionAPI `yaml:"api"`
Android SectionAndroid `yaml:"android"`
Huawei SectionHuawei `yaml:"huawei"`
Ios SectionIos `yaml:"ios"`
SMSFactor SectionSMSFactor `yaml:"smsfactor"`
Queue SectionQueue `yaml:"queue"`
Log SectionLog `yaml:"log"`
Stat SectionStat `yaml:"stat"`
GRPC SectionGRPC `yaml:"grpc"`
}
// SectionCore is sub section of config.
@@ -201,6 +202,13 @@ type SectionIos struct {
TeamID string `yaml:"team_id"`
}
// SectionIos is sub section of config.
type SectionSMSFactor struct {
Enabled bool `yaml:"enabled"`
APIKey string `yaml:"apikey"`
MaxRetry int `yaml:"max_retry"`
}
// SectionLog is sub section of config.
type SectionLog struct {
Format string `yaml:"format"`
@@ -392,6 +400,11 @@ func LoadConf(confPath ...string) (*ConfYaml, error) {
conf.Ios.KeyID = viper.GetString("ios.key_id")
conf.Ios.TeamID = viper.GetString("ios.team_id")
// SMSFactor
conf.SMSFactor.Enabled = viper.GetBool("smsfactor.enabled")
conf.SMSFactor.APIKey = viper.GetString("smsfactor.apikey")
conf.SMSFactor.MaxRetry = viper.GetInt("smsfactor.max_retry")
// log
conf.Log.Format = viper.GetString("log.format")
conf.Log.AccessLog = viper.GetString("log.access_log")