2024-10-19 13:00:06 +08:00
|
|
|
{ lib, ports, ... }:
|
2024-09-06 20:19:44 +08:00
|
|
|
let
|
2024-10-19 13:00:06 +08:00
|
|
|
port = ports.redlib;
|
2024-09-06 20:19:44 +08:00
|
|
|
in
|
2024-08-27 17:08:53 +08:00
|
|
|
{
|
|
|
|
services.redlib = {
|
2024-09-06 20:19:44 +08:00
|
|
|
inherit port;
|
2024-08-27 17:08:53 +08:00
|
|
|
enable = true;
|
|
|
|
address = "127.0.0.1";
|
|
|
|
};
|
2024-08-31 10:15:09 +08:00
|
|
|
|
2024-10-05 20:13:21 +08:00
|
|
|
systemd.services."redlib".environment = {
|
|
|
|
# Google's indexing caused a DoS with 800k requests...
|
|
|
|
# https://developers.google.com/search/docs/crawling-indexing/block-indexing
|
|
|
|
REDLIB_ROBOTS_DISABLE_INDEXING = "on";
|
|
|
|
REDLIB_DEFAULT_USE_HLS = "on";
|
|
|
|
};
|
|
|
|
|
2024-08-31 10:15:09 +08:00
|
|
|
services.caddy.settings.apps.http.servers.srv0.routes = lib.singleton {
|
2024-09-21 01:38:01 +08:00
|
|
|
match = lib.singleton { host = [ "reddit.ny4.dev" ]; };
|
2024-10-05 20:13:21 +08:00
|
|
|
handle = lib.singleton {
|
|
|
|
handler = "reverse_proxy";
|
|
|
|
upstreams = [ { dial = "localhost:${toString port}"; } ];
|
|
|
|
};
|
2024-08-31 10:15:09 +08:00
|
|
|
};
|
2024-08-27 17:08:53 +08:00
|
|
|
}
|