housekeeping

This commit is contained in:
m5r
2023-12-12 22:25:39 +01:00
parent 45e35acfd9
commit 9ef6fc35f5
9 changed files with 90 additions and 42 deletions

View File

@@ -18,17 +18,19 @@ import (
)
type Account struct {
Email string
Registration *registration.Resource
key *ecdsa.PrivateKey
Email string
}
func (u *Account) GetEmail() string {
return u.Email
}
func (u *Account) GetRegistration() *registration.Resource {
return u.Registration
}
func (u *Account) GetPrivateKey() crypto.PrivateKey {
return u.key
}
@@ -71,8 +73,14 @@ func RegisterAccount() {
config := lego.NewConfig(account)
config.CADirURL = caDirUrl
legoClient, err := lego.NewClient(config)
if err != nil {
log.Fatal(err)
}
reg, err := legoClient.Registration.Register(registration.RegisterOptions{TermsOfServiceAgreed: true})
if err != nil {
log.Fatal(err)
}
if reg.Body.Status != "valid" {
log.Fatalf("registration failed with status %s", reg.Body.Status)
}