refactor: consolidate config keys and cache TTL constants

- Move caaEnabledKey and uguuEnabledKey to main.go config const block
- Extract uguu cache TTL magic number (9000) to named constant
- Add 5s timeout to CAA HEAD requests
This commit is contained in:
deluan
2026-03-20 20:00:19 -04:00
parent 40be06fee5
commit 6ed2c2ce45
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -134,11 +134,11 @@ var _ = Describe("getImageURL", func() {
})).Return(&host.HTTPResponse{StatusCode: 200, Body: []byte(`{"success":true,"files":[{"url":"https://a.uguu.se/uploaded.jpg"}]}`)}, nil)
// Mock cache set
host.CacheMock.On("SetString", "uguu.artwork.track1", "https://a.uguu.se/uploaded.jpg", int64(9000)).Return(nil)
host.CacheMock.On("SetString", "uguu.artwork.track1", "https://a.uguu.se/uploaded.jpg", uguuCacheTTL).Return(nil)
url := getImageURL("testuser", scrobbler.TrackInfo{ID: "track1"})
Expect(url).To(Equal("https://a.uguu.se/uploaded.jpg"))
host.CacheMock.AssertCalled(GinkgoT(), "SetString", "uguu.artwork.track1", "https://a.uguu.se/uploaded.jpg", int64(9000))
host.CacheMock.AssertCalled(GinkgoT(), "SetString", "uguu.artwork.track1", "https://a.uguu.se/uploaded.jpg", uguuCacheTTL)
})
It("returns empty when artwork data fetch fails", func() {