1
0
mirror of https://github.com/go-acme/lego.git synced 2024-12-23 01:07:23 +02:00

feat: fills LEGO_CERT_PFX_PATH and LEGO_CERT_PEM_PATH only when needed (#2160)

This commit is contained in:
Ludovic Fernandez 2024-04-16 23:10:59 +02:00 committed by GitHub
parent 55dd478cb2
commit d60c335cc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 4 deletions

View File

@ -90,6 +90,11 @@ linters-settings:
disable:
- require-error
- go-require
perfsprint:
err-error: true
errorf: true
sprintf1: true
strconcat: false
linters:
enable-all: true
@ -149,7 +154,6 @@ issues:
- 'Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
- 'exported (type|method|function) (.+) should have comment or be unexported'
- 'ST1000: at least one file in a package should have a package comment'
- 'fmt.Sprintf can be replaced with string'
exclude-rules:
- path: (.+)_test.go
linters:
@ -227,6 +231,6 @@ issues:
- path: providers/dns/hosttech/internal/client_test.go
text: 'Duplicate words \(0\) found'
- path: cmd/cmd_renew.go
text: 'cyclomatic complexity \d+ of func `renewForDomains` is high'
text: 'cyclomatic complexity \d+ of func `(renewForDomains|renewForCSR)` is high'
- path: providers/dns/cpanel/cpanel.go
text: 'cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high'

View File

@ -215,8 +215,14 @@ func renewForDomains(ctx *cli.Context, client *lego.Client, certsStorage *Certif
meta[renewEnvCertDomain] = domain
meta[renewEnvCertPath] = certsStorage.GetFileName(domain, ".crt")
meta[renewEnvCertKeyPath] = certsStorage.GetFileName(domain, ".key")
meta[renewEnvCertPEMPath] = certsStorage.GetFileName(domain, ".pem")
meta[renewEnvCertPFXPath] = certsStorage.GetFileName(domain, ".pfx")
if certsStorage.pem {
meta[renewEnvCertPEMPath] = certsStorage.GetFileName(domain, ".pem")
}
if certsStorage.pfx {
meta[renewEnvCertPFXPath] = certsStorage.GetFileName(domain, ".pfx")
}
return launchHook(ctx.String("renew-hook"), meta)
}
@ -290,6 +296,14 @@ func renewForCSR(ctx *cli.Context, client *lego.Client, certsStorage *Certificat
meta[renewEnvCertPath] = certsStorage.GetFileName(domain, ".crt")
meta[renewEnvCertKeyPath] = certsStorage.GetFileName(domain, ".key")
if certsStorage.pem {
meta[renewEnvCertPEMPath] = certsStorage.GetFileName(domain, ".pem")
}
if certsStorage.pfx {
meta[renewEnvCertPFXPath] = certsStorage.GetFileName(domain, ".pfx")
}
return launchHook(ctx.String("renew-hook"), meta)
}

View File

@ -104,6 +104,8 @@ Some information is provided through environment variables:
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
- `LEGO_CERT_PATH`: the path of the certificate.
- `LEGO_CERT_KEY_PATH`: the path of the certificate key.
- `LEGO_CERT_PEM_PATH`: (only with `--pem`) the path to the PEM certificate.
- `LEGO_CERT_PFX_PATH`: (only with `--pfx`) the path to the PFX certificate.
### Use case

View File

@ -61,6 +61,8 @@ Some information is provided through environment variables:
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
- `LEGO_CERT_PATH`: the path of the certificate.
- `LEGO_CERT_KEY_PATH`: the path of the certificate key.
- `LEGO_CERT_PEM_PATH`: (only with `--pem`) the path to the PEM certificate.
- `LEGO_CERT_PFX_PATH`: (only with `--pfx`) the path to the PFX certificate.
See [Obtain a Certificate → Use case]({{< ref "usage/cli/Obtain-a-Certificate#use-case" >}}) for an example script.