Skip to content

Commit

Permalink
Document AcquireCertificate
Browse files Browse the repository at this point in the history
  • Loading branch information
csnewman committed Jul 10, 2023
1 parent 5527f8b commit 61bde09
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions website/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ name = "Docs"
url = "/docs/start"
weight = 2

[[menu.main]]
name = "GitHub"
url = "https://github.com/csnewman/dyndirect"
weight = 3

[params]
homepage_button_link = '/docs/start'
homepage_button_text = 'Read The Docs'
Expand Down
31 changes: 31 additions & 0 deletions website/content/docs/go/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,34 @@ if err != nil {

The challenge token will expire after some period of time. You should not rely on this value being available for any
extended period.

#### Automatically acquire certificate

Instead of calling `SetSubdomainACMEChallenge` directly, you can use the `AcquireCertificate` helper to simplify the
process:

```go
res, err := c.AcquireCertificate(ctx, dsdm.AcquireCertificateRequest{
ID: r.Id,
Domain: r.Domain,
Token: r.Token,
Provider: dsdm.ProviderZeroSSL,
KeyType: certcrypto.RSA2048,
Timeout: 60 * time.Second,
SilenceLog: true,
})
if err != nil {
// ...
}

log.Info("Domain ", res.Domain)
log.Info("CertURL ", res.CertURL)
log.Info("CertStableURL ", res.CertStableURL)
log.Info("PrivateKey ", len(res.PrivateKey))
log.Info("Certificate ", len(res.Certificate))
log.Info("IssuerCertificate ", len(res.IssuerCertificate))
log.Info("CSR ", len(res.CSR))
```

`AcquireCertificate` implies acceptance of the TOS of the respective provider. Some providers may apply rate limits,
such as by IP.

0 comments on commit 61bde09

Please sign in to comment.