From a7664ce44bdfde5c3a2b842b52b95576d262e7f5 Mon Sep 17 00:00:00 2001 From: sinavir Date: Fri, 15 Mar 2024 21:55:42 +0100 Subject: [PATCH] feat(garage): Add ambassadeurices sante website --- machines/storage01/garage.nix | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/machines/storage01/garage.nix b/machines/storage01/garage.nix index f01c07f..446aee2 100644 --- a/machines/storage01/garage.nix +++ b/machines/storage01/garage.nix @@ -1,4 +1,9 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + lib, + ... +}: let host = "s3.dgnum.eu"; @@ -7,10 +12,13 @@ let data_dir = "/data/slow/garage/data"; metadata_dir = "/data/fast/garage/meta"; - buckets = [ - "castopod-dgnum" - "peertube-videos-dgnum" - ]; + buckets = { + "castopod-dgnum" = { }; + "peertube-videos-dgnum" = { }; + "boussole-sante.normalesup.eu" = { + mainDomain = true; + }; + }; in { services.garage = { @@ -68,7 +76,7 @@ in enableACME = true; forceSSL = true; - serverAliases = builtins.map (b: "${b}.${host}") buckets; + serverAliases = builtins.map (b: "${b}.${host}") (builtins.attrNames buckets); locations."/".extraConfig = '' proxy_pass http://127.0.0.1:3900; @@ -84,7 +92,11 @@ in enableACME = true; forceSSL = true; - serverAliases = builtins.map (b: "${b}.${webHost}") buckets; + serverAliases = lib.flatten ( + lib.mapAttrsToList ( + b: v: lib.singleton "${b}.${webHost}" ++ lib.optional (v ? mainDomain && v.mainDomain) b + ) buckets + ); locations."/".extraConfig = '' proxy_pass http://127.0.0.1:3902;