git » chasquid » commit 36c5139

Skip non-directories in the domains/ directory

author Ernesto Alfonso
2023-12-08 17:39:09 UTC
committer Alberto Bertogli
2024-02-05 00:04:37 UTC
parent bb8f16fb975420e9b30aad918afcd01f70aa08e7

Skip non-directories in the domains/ directory

This prevents chasquid from attempting to look for certs under a
non-directory, e.g. `/etc/chasquid/domains/.gitignore/certs`.

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Adjusted commit message, applied `go fmt`.

chasquid.go +4 -0

diff --git a/chasquid.go b/chasquid.go
index bd850bb..b1585b6 100644
--- a/chasquid.go
+++ b/chasquid.go
@@ -109,6 +109,10 @@ func main() {
 		if err != nil {
 			log.Fatalf("Invalid name %+q: %v", info.Name(), err)
 		}
+		if info.Type().IsRegular() {
+			// Ignore regular files, we only care about directories.
+			continue
+		}
 		dir := filepath.Join("domains", info.Name())
 		loadDomain(domain, dir, s)
 	}