func runUpdate(args []string) { uc, err := readConfig() if err != nil { fatalf("read config: %v", err) } if uc.key == nil { fatalf("no key found for %s", uc.URI) } client := acme.Client{Key: uc.key} ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() if updateAccept { a, err := client.GetReg(ctx, uc.URI) if err != nil { fatalf(err.Error()) } uc.Account = *a uc.AgreedTerms = a.CurrentTerms } if len(args) != 0 { uc.Contact = args } a, err := client.UpdateReg(ctx, &uc.Account) if err != nil { fatalf(err.Error()) } uc.Account = *a if err := writeConfig(uc); err != nil { fatalf("write config: %v", err) } printAccount(os.Stdout, &uc.Account, filepath.Join(configDir, accountKey)) }
func runWhoami([]string) { uc, err := readConfig() if err != nil { fatalf("read config: %v", err) } if uc.key == nil { fatalf("no key found for %s", uc.URI) } ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() client := acme.Client{Key: uc.key} a, err := client.GetReg(ctx, uc.URI) if err != nil { fatalf(err.Error()) } printAccount(os.Stdout, a, filepath.Join(configDir, accountKey)) }