about summary refs log tree commit diff stats
path: root/internal/importer
diff options
context:
space:
mode:
authorAlan Pearce2024-05-14 21:16:23 +0200
committerAlan Pearce2024-05-14 21:45:02 +0200
commit1a5c82e2d08accb6330c4164ab987b87157b10ed (patch)
tree48d6a913809e60b1a0cc28a8b67413ffaf979f97 /internal/importer
parentf08094f23aa4dc7d63a7c98b4429d88005fe3a2d (diff)
downloadsearchix-1a5c82e2d08accb6330c4164ab987b87157b10ed.tar.lz
searchix-1a5c82e2d08accb6330c4164ab987b87157b10ed.tar.zst
searchix-1a5c82e2d08accb6330c4164ab987b87157b10ed.zip
build: bake git hash into build for headers and --version
Diffstat (limited to 'internal/importer')
-rw-r--r--internal/importer/http.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/importer/http.go b/internal/importer/http.go
index 6d60c44..b496177 100644
--- a/internal/importer/http.go
+++ b/internal/importer/http.go
@@ -6,6 +6,7 @@ import (
 	"log/slog"
 	"net/http"
 	"os"
+	"searchix/internal/config"
 	"searchix/internal/file"
 	"strings"
 	"time"
@@ -29,6 +30,8 @@ func fetchFileIfNeeded(ctx context.Context, path string, url string) (needed boo
 		return false, errors.WithMessagef(err, "could not create HTTP request for %s", url)
 	}
 
+	req.Header.Set("User-Agent", fmt.Sprintf("Searchix %s", config.ShortSHA))
+
 	if mtime != "" {
 		req.Header.Set("If-Modified-Since", mtime)
 	}