caddy support multi domain

This commit is contained in:
pazpi 2025-01-06 18:24:12 +01:00
parent f15e521895
commit fdcc829acf
13 changed files with 344 additions and 141 deletions

View file

@ -12,6 +12,14 @@ in
options.my.services.searx = {
enable = lib.mkEnableOption "Enable searXNG module";
secretFile = lib.mkOption {
default = "";
type = lib.types.str;
description = ''
Path to the file containing the secret for searXNG
'';
};
proxy = {
enable = lib.mkEnableOption "Set the proxy entry for this service";
@ -37,12 +45,10 @@ in
config = lib.mkMerge [
(lib.mkIf cfg.enable {
age.secrets.searx-secret.file = ../../secrets/searx-secret.age;
services.searcx = {
services.searx = {
enable = true;
redisCreateLocally = true;
environmentFile = config.age.secrets.searx-secret.path;
environmentFile = cfg.secretFile;
settings = {
general = {
open_metrics = "@METRICS_SECRET@";
@ -63,7 +69,7 @@ in
services.caddy = with cfg.proxy; {
virtualHosts."search.${domain}".extraConfig = ''
reverse_proxy http://${host}:8080
import cloudflare
import cloudflare_${domain}
'';
};
})