mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
bbgo: move authToken loader
This commit is contained in:
parent
3a13025d58
commit
e385d96709
|
@ -560,12 +560,6 @@ func (environ *Environment) ConfigureNotificationSystem(userConfig *Config) erro
|
|||
}
|
||||
|
||||
persistence := environ.PersistenceServiceFacade.Get()
|
||||
authToken := viper.GetString("telegram-bot-auth-token")
|
||||
|
||||
if len(authToken) > 0 {
|
||||
log.Debugf("telegram bot auth token is set, using fixed token for authorization...")
|
||||
printAuthTokenGuide(authToken)
|
||||
}
|
||||
|
||||
var otpQRCodeImagePath = fmt.Sprintf("otp.png")
|
||||
var key *otp.Key
|
||||
|
@ -599,6 +593,8 @@ func (environ *Environment) ConfigureNotificationSystem(userConfig *Config) erro
|
|||
|
||||
authStrict := false
|
||||
authMode := interact.AuthModeToken
|
||||
authToken := viper.GetString("telegram-bot-auth-token")
|
||||
|
||||
if authToken != "" && key != nil {
|
||||
authStrict = true
|
||||
} else if authToken != "" {
|
||||
|
@ -607,6 +603,11 @@ func (environ *Environment) ConfigureNotificationSystem(userConfig *Config) erro
|
|||
authMode = interact.AuthModeOTP
|
||||
}
|
||||
|
||||
if authMode == interact.AuthModeToken {
|
||||
log.Debugf("found interaction auth token, using token mode for authorization...")
|
||||
printAuthTokenGuide(authToken)
|
||||
}
|
||||
|
||||
interact.AddCustomInteraction(&interact.AuthInteract{
|
||||
Strict: authStrict,
|
||||
Mode: authMode,
|
||||
|
|
Loading…
Reference in New Issue
Block a user