Skip to content

Commit 87e9c48

Browse files
committed
refactor: remove odd duplication of appstream data base url
1 parent d4924cd commit 87e9c48

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

internal/appstream/update.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ import (
1414
"time"
1515
)
1616

17-
// DefaultSourcesBase is the directory listing published by Arch that contains
18-
// versioned snapshots (e.g. …/20260326/{core,extra,multilib}/Components-x86_64.xml.gz).
19-
const DefaultSourcesBase = "https://sources.archlinux.org/other/packages/archlinux-appstream-data/"
20-
17+
// archlinuxPackageJSON is the official package metadata used to resolve the
18+
// appstream-data snapshot directory name (pkgver). The XML base URL is passed
19+
// into Update as sourcesBase (from config.APPSTREAM_SOURCES_BASE / CLI).
2120
const archlinuxPackageJSON = "https://archlinux.org/packages/extra/any/archlinux-appstream-data/json/"
2221

2322
const (
@@ -62,8 +61,8 @@ func LatestRelease(ctx context.Context, client *http.Client) (string, error) {
6261
}
6362

6463
// Update downloads AppStream component XML for core, extra, and multilib from
65-
// sourcesBase, merges keywords and categories by package name, writes both columns,
66-
// and rebuilds the FTS index.
64+
// sourcesBase (e.g. config.AppStreamSourcesBase), merges keywords and categories
65+
// by package name, writes both columns, and rebuilds the FTS index.
6766
func Update(ctx context.Context, db *sql.DB, client *http.Client, sourcesBase string) error {
6867
if client == nil {
6968
client = &http.Client{Timeout: httpClientTimeoutUpdate}

internal/config/config.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ type Config struct {
1515

1616
func Load() (Config, error) {
1717
cfg := Config{
18-
Database: getEnv("DATABASE", ""),
19-
Port: getEnv("PORT", "8080"),
20-
PackagesMirror: getEnv("PACKAGES_MIRROR", "https://geo.mirror.pkgbuild.com/"),
21-
DefaultMirror: getEnv("DEFAULT_MIRROR", "https://geo.mirror.pkgbuild.com/"),
18+
Database: getEnv("DATABASE", ""),
19+
Port: getEnv("PORT", "8080"),
20+
PackagesMirror: getEnv("PACKAGES_MIRROR", "https://geo.mirror.pkgbuild.com/"),
21+
DefaultMirror: getEnv("DEFAULT_MIRROR", "https://geo.mirror.pkgbuild.com/"),
22+
// Arch appstream-data snapshot root (override for tests or mirrors).
2223
AppStreamSourcesBase: getEnv("APPSTREAM_SOURCES_BASE", "https://sources.archlinux.org/other/packages/archlinux-appstream-data/"),
2324
}
2425

0 commit comments

Comments
 (0)