mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-18 14:47:03 +00:00
chasquid: Ignore non-directories in certs/
We only care about directories within the certs/, but the code as-is complains if there are files. This patch makes the iteration skip non-directories entirely. Thanks to Martin Ferrari for the bug report!
This commit is contained in:
10
chasquid.go
10
chasquid.go
@@ -94,13 +94,19 @@ func main() {
|
|||||||
log.Infof("Loading certificates")
|
log.Infof("Loading certificates")
|
||||||
for _, info := range mustReadDir("certs/") {
|
for _, info := range mustReadDir("certs/") {
|
||||||
name := info.Name()
|
name := info.Name()
|
||||||
|
dir := filepath.Join("certs/", name)
|
||||||
|
if fi, err := os.Stat(dir); err == nil && !fi.IsDir() {
|
||||||
|
// Skip non-directories.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
log.Infof(" %s", name)
|
log.Infof(" %s", name)
|
||||||
|
|
||||||
certPath := filepath.Join("certs/", name, "fullchain.pem")
|
certPath := filepath.Join(dir, "fullchain.pem")
|
||||||
if _, err := os.Stat(certPath); os.IsNotExist(err) {
|
if _, err := os.Stat(certPath); os.IsNotExist(err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
keyPath := filepath.Join("certs/", name, "privkey.pem")
|
keyPath := filepath.Join(dir, "privkey.pem")
|
||||||
if _, err := os.Stat(keyPath); os.IsNotExist(err) {
|
if _, err := os.Stat(keyPath); os.IsNotExist(err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user