feat: fills LEGO_CERT_PFX_PATH and LEGO_CERT_PEM_PATH only when needed (#2160)
This commit is contained in:
parent
55dd478cb2
commit
d60c335cc0
4 changed files with 26 additions and 4 deletions
|
@ -90,6 +90,11 @@ linters-settings:
|
||||||
disable:
|
disable:
|
||||||
- require-error
|
- require-error
|
||||||
- go-require
|
- go-require
|
||||||
|
perfsprint:
|
||||||
|
err-error: true
|
||||||
|
errorf: true
|
||||||
|
sprintf1: true
|
||||||
|
strconcat: false
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
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'
|
- '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'
|
- 'exported (type|method|function) (.+) should have comment or be unexported'
|
||||||
- 'ST1000: at least one file in a package should have a package comment'
|
- 'ST1000: at least one file in a package should have a package comment'
|
||||||
- 'fmt.Sprintf can be replaced with string'
|
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- path: (.+)_test.go
|
- path: (.+)_test.go
|
||||||
linters:
|
linters:
|
||||||
|
@ -227,6 +231,6 @@ issues:
|
||||||
- path: providers/dns/hosttech/internal/client_test.go
|
- path: providers/dns/hosttech/internal/client_test.go
|
||||||
text: 'Duplicate words \(0\) found'
|
text: 'Duplicate words \(0\) found'
|
||||||
- path: cmd/cmd_renew.go
|
- 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
|
- path: providers/dns/cpanel/cpanel.go
|
||||||
text: 'cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high'
|
text: 'cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high'
|
||||||
|
|
|
@ -215,8 +215,14 @@ func renewForDomains(ctx *cli.Context, client *lego.Client, certsStorage *Certif
|
||||||
meta[renewEnvCertDomain] = domain
|
meta[renewEnvCertDomain] = domain
|
||||||
meta[renewEnvCertPath] = certsStorage.GetFileName(domain, ".crt")
|
meta[renewEnvCertPath] = certsStorage.GetFileName(domain, ".crt")
|
||||||
meta[renewEnvCertKeyPath] = certsStorage.GetFileName(domain, ".key")
|
meta[renewEnvCertKeyPath] = certsStorage.GetFileName(domain, ".key")
|
||||||
|
|
||||||
|
if certsStorage.pem {
|
||||||
meta[renewEnvCertPEMPath] = certsStorage.GetFileName(domain, ".pem")
|
meta[renewEnvCertPEMPath] = certsStorage.GetFileName(domain, ".pem")
|
||||||
|
}
|
||||||
|
|
||||||
|
if certsStorage.pfx {
|
||||||
meta[renewEnvCertPFXPath] = certsStorage.GetFileName(domain, ".pfx")
|
meta[renewEnvCertPFXPath] = certsStorage.GetFileName(domain, ".pfx")
|
||||||
|
}
|
||||||
|
|
||||||
return launchHook(ctx.String("renew-hook"), meta)
|
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[renewEnvCertPath] = certsStorage.GetFileName(domain, ".crt")
|
||||||
meta[renewEnvCertKeyPath] = certsStorage.GetFileName(domain, ".key")
|
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)
|
return launchHook(ctx.String("renew-hook"), meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,8 @@ Some information is provided through environment variables:
|
||||||
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
|
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
|
||||||
- `LEGO_CERT_PATH`: the path of the certificate.
|
- `LEGO_CERT_PATH`: the path of the certificate.
|
||||||
- `LEGO_CERT_KEY_PATH`: the path of the certificate key.
|
- `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
|
### Use case
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ Some information is provided through environment variables:
|
||||||
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
|
- `LEGO_CERT_DOMAIN`: the main domain of the certificate.
|
||||||
- `LEGO_CERT_PATH`: the path of the certificate.
|
- `LEGO_CERT_PATH`: the path of the certificate.
|
||||||
- `LEGO_CERT_KEY_PATH`: the path of the certificate key.
|
- `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.
|
See [Obtain a Certificate → Use case]({{< ref "usage/cli/Obtain-a-Certificate#use-case" >}}) for an example script.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue