mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add FLUSH_OTP_KEY env for flushing otp key
This commit is contained in:
parent
63f525970f
commit
ad373b95a7
|
@ -597,7 +597,6 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
|
|||
position.StrategyInstanceID = profit.StrategyInstanceID
|
||||
}
|
||||
|
||||
|
||||
if profit != nil {
|
||||
if err := environ.PositionService.Insert(position, trade, profit.Profit); err != nil {
|
||||
log.WithError(err).Errorf("can not insert position record")
|
||||
|
@ -611,7 +610,6 @@ func (environ *Environment) RecordPosition(position *types.Position, trade types
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// if:
|
||||
// 1) we are not using sync
|
||||
// 2) and not sync-ing trades from the user data stream
|
||||
|
@ -739,6 +737,14 @@ func (environ *Environment) setupInteraction(persistence service.PersistenceServ
|
|||
var key *otp.Key
|
||||
var keyURL string
|
||||
var authStore = environ.getAuthStore(persistence)
|
||||
|
||||
if v, ok := util.GetEnvVarBool("FLUSH_OTP_KEY"); v && ok {
|
||||
log.Warnf("flushing otp key...")
|
||||
if err := authStore.Reset(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := authStore.Load(&keyURL); err != nil {
|
||||
log.Warnf("telegram session not found, generating new one-time password key for new telegram session...")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user