Turn the media cache on by default !12

merged merged by cmc on 2026-09-11 15:13 UTC · krz/skunky-art:chore/cache-default-on into main

4 files changed, +11 −6

Layout: unified · split

.mailmap deleted −4
@@ -1,4 +0,0 @@
1lost+skunk <skunky@ebloid.ru> <skunky@macaw.me>
2lost+skunk <skunky@ebloid.ru> <me@lost-skunk.cc>
3lost+skunk <skunky@ebloid.ru> <skunky@noreply.git.macaw.me>
4lost+skunk <skunky@ebloid.ru> skunky <skunky@ebloid.ru>
SETUP.md +1 −1
@@ -11,7 +11,7 @@ Time units:
11# Config 11# Config
12* `listen` — IP and port to listen on in the following form: ip:port 12* `listen` — IP and port to listen on in the following form: ip:port
13* `uri` — Instance URI. Example: `"uri":"/art/"` -> https://skunky.ebloid.ru/art/ 13* `uri` — Instance URI. Example: `"uri":"/art/"` -> https://skunky.ebloid.ru/art/
14* `cache` — Caching system for proxied media, avatars and emotes; default is off. 14* `cache` — Caching system for proxied media, avatars and emotes. On by default: `path` `cache`, `lifetime` `1w`, `max-size` `200`, `memcache` off. A proxying instance with no cache re-fetches every image from wixmp on every view, which is the pattern that gets an egress IP blocked.
15 * `enabled` — Caching system state, requires boolean value 15 * `enabled` — Caching system state, requires boolean value
16 * `path` — Path to cache directory. It must be writable by the user SkunkyArt 16 * `path` — Path to cache directory. It must be writable by the user SkunkyArt
17 runs as, and SkunkyArt refuses to start if it is not. The container image 17 runs as, and SkunkyArt refuses to start if it is not. The container image
app/config.go +3 −1
@@ -65,8 +65,10 @@ var CFG = config{
65 Language: "auto", 65 Language: "auto",
66 URI: "/", 66 URI: "/",
67 Cache: cacheConfig{ 67 Cache: cacheConfig{
68 Enabled: false, 68 Enabled: true,
69 Path: "cache", 69 Path: "cache",
70 Lifetime: "1w",
71 MaxSize: 200,
70 UpdateInterval: 1, 72 UpdateInterval: 1,
71 }, 73 },
72 APICache: apiCacheConfig{ 74 APICache: apiCacheConfig{
app/config_test.go +7
@@ -36,3 +36,10 @@ func TestAPICacheDefaults(t *testing.T) {
36 t.Errorf("defaults are %+v, want enabled, 64 MB, 5i", CFG.APICache) 36 t.Errorf("defaults are %+v, want enabled, 64 MB, 5i", CFG.APICache)
37 } 37 }
38} 38}
39
40func TestMediaCacheDefaults(t *testing.T) {
41 c := CFG.Cache
42 if !c.Enabled || c.Lifetime != "1w" || c.MaxSize != 200 || c.MemCache {
43 t.Errorf("defaults are %+v, want enabled, 1w, 200 MB, memcache off", c)
44 }
45}