1
0
mirror of https://github.com/getsops/sotp.git synced 2026-02-05 09:45:59 +01:00

fix logging

This commit is contained in:
Julien Vehent
2020-03-31 14:47:41 -04:00
parent 1254c71fde
commit a843c2e758

View File

@@ -31,19 +31,17 @@ func main() {
}
cfg, err := decryptConfig("config.yaml")
if err != nil {
log.Fatal(err)
log.Fatal("failed to access configuration at 'config.yaml'", err)
}
var totpSecret string
for _, account := range cfg.Accounts {
if account.Name == os.Args[1] {
totpSecret = account.TOTPSecret
}
if totpSecret != "" {
break
}
}
if totpSecret == "" {
fmt.Println("no totp information found for account", os.Args[1])
log.Fatal("no totp information found for account", os.Args[1])
}
otp := gotp.NewDefaultTOTP(totpSecret)