fix: config paths on windows

Ayman Bagabas created

Convert slashes on windows

Fixes: https://github.com/charmbracelet/soft-serve/issues/367

Change summary

server/config/file.go | 8 ++++----
server/hooks/gen.go   | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)

Detailed changes

server/config/file.go 🔗

@@ -31,11 +31,11 @@ ssh:
   public_url: "{{ .SSH.PublicURL }}"
 
   # The path to the SSH server's private key.
-  key_path: "{{ .SSH.KeyPath }}"
+  key_path: {{ .SSH.KeyPath }}
 
   # The path to the server's client private key. This key will be used to
   # authenticate the server to make git requests to ssh remotes.
-  client_key_path: "{{ .SSH.ClientKeyPath }}"
+  client_key_path: {{ .SSH.ClientKeyPath }}
 
   # The maximum number of seconds a connection can take.
   # A value of 0 means no timeout.
@@ -66,10 +66,10 @@ http:
   listen_addr: "{{ .HTTP.ListenAddr }}"
 
   # The path to the TLS private key.
-  tls_key_path: "{{ .HTTP.TLSKeyPath }}"
+  tls_key_path: {{ .HTTP.TLSKeyPath }}
 
   # The path to the TLS certificate.
-  tls_cert_path: "{{ .HTTP.TLSCertPath }}"
+  tls_cert_path: {{ .HTTP.TLSCertPath }}
 
   # The public URL of the HTTP server.
   # This is the address that will be used to clone repositories.

server/hooks/gen.go 🔗

@@ -46,6 +46,9 @@ func GenerateHooks(_ context.Context, cfg *config.Config, repo string) error {
 		return err
 	}
 
+	// Convert to forward slashes for Windows.
+	ex = filepath.ToSlash(ex)
+
 	for _, hook := range []string{
 		PreReceiveHook,
 		UpdateHook,