go-container: порт 5000, GPG 2 ключа, darwin, Dockerfile

This commit is contained in:
“Naeel”
2026-08-06 21:07:21 +04:00
parent 881add2fbb
commit a0e72b1c7f
3 changed files with 151 additions and 9 deletions
+10 -5
View File
@@ -97,8 +97,12 @@ func main() {
http.HandleFunc("/healthz", healthzHandler)
http.HandleFunc("/readyz", readyzHandler)
log.Printf("Starting Registry Service on :8080 (Bucket: %s, Endpoint: %s)\n", bucketName, endpoint)
log.Fatal(http.ListenAndServe(":8080", nil))
port := os.Getenv("PORT")
if port == "" {
port = "5000"
}
log.Printf("Starting Registry Service on :%s (Bucket: %s, Endpoint: %s)\n", port, bucketName, endpoint)
log.Fatal(http.ListenAndServe(":"+port, nil))
}
func rootHandler(w http.ResponseWriter, r *http.Request) {
@@ -206,6 +210,9 @@ func listVersions(w http.ResponseWriter, r *http.Request, namespace, pType strin
}
}
if strings.Contains(fileName, "_darwin_amd64.zip") {
seenVersions[verStr].Platforms = append(seenVersions[verStr].Platforms, Platform{OS: "darwin", Arch: "amd64"})
}
if strings.Contains(fileName, "_linux_amd64.zip") {
seenVersions[verStr].Platforms = append(seenVersions[verStr].Platforms, Platform{OS: "linux", Arch: "amd64"})
}
@@ -256,8 +263,6 @@ func downloadVersion(w http.ResponseWriter, r *http.Request, namespace, pType, v
shasumsLink := fmt.Sprintf("%s/v1/proxy?bucket=%s&key=%s", baseURL, bucketName, url.QueryEscape(shasumsKey))
sigLink := fmt.Sprintf("%s/v1/proxy?bucket=%s&key=%s", baseURL, bucketName, url.QueryEscape(sigKey))
gpgKey := gpgPublicKey
resp := DownloadResponse{
Protocols: []string{"5.0"},
OS: osType,
@@ -268,7 +273,7 @@ func downloadVersion(w http.ResponseWriter, r *http.Request, namespace, pType, v
ShasumsSignatureURL: sigLink,
Shasum: shasumValue,
SigningKeys: SigningKeys{
GPGPublicKeys: []GPGPublicKey{gpgKey},
GPGPublicKeys: []GPGPublicKey{gpgPrimaryKey, gpgLegacyKey},
},
}