Commit 40fb6f041d

40fb6f041df5470b7b175d8a1bbb2296d244c785

parent: 778622bce5

Verified · cmc ci/build: success ci/lint: success ci/test: success

cmc <hello@cleberg.net> · 2026-09-11 02:56 UTC

Turn the media cache on by default

A proxying instance with no cache re-fetches every image from wixmp on
every view. Defaults: enabled, lifetime 1w, max-size 200 MB, memcache
off. A config that sets enabled to false still turns it off.

Closes #12

Layout: unified · split

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}