Compare commits

..

No commits in common. "b1173f53bdde59adc6233cd77f9c39a5a66bf65d" and "83632f5cf9492f83e1498974b137facf7795b8c3" have entirely different histories.

3 changed files with 42 additions and 76 deletions

View file

@ -417,10 +417,7 @@ Example host configuration:
config.sops.secrets."borg-private-key".path;
};
frontend = {
hostName = "rabbigerzi.com";
redirectHostNames = [ "www.rabbigerzi.com" ];
};
frontend.hostName = "rabbigerzi.com";
backend = {
hostName = "api.rabbigerzi.com";

View file

@ -23,10 +23,7 @@ let
borgPassphrase = "/run/secrets/borg-passphrase";
borgPrivateKey = "/run/secrets/borg-private-key";
};
frontend = {
hostName = "example.test";
redirectHostNames = [ "www.example.test" ];
};
frontend.hostName = "www.example.test";
backend = {
hostName = "api.example.test";
environmentFile = "/run/secrets/rabbi-gerzi.env";
@ -38,10 +35,6 @@ let
evaluatedHostName = evaluatedConfig.services.rabbi-gerzi.backend.hostName;
evaluatedFrontendHostName = evaluatedConfig.services.rabbi-gerzi.frontend.hostName;
frontendRedirectVirtualHost = evaluatedConfig.services.nginx.virtualHosts."www.example.test";
backendVirtualHost = evaluatedConfig.services.nginx.virtualHosts.${evaluatedHostName};
phpOptions = evaluatedConfig.services.phpfpm.pools.rabbi-gerzi.phpOptions;
@ -73,18 +66,6 @@ let
passed = lib.hasInfix expectedNginxClientMaxBodySize backendVirtualHost.extraConfig;
message = "nginx client_max_body_size is not 6m";
}
{
passed = frontendRedirectVirtualHost.globalRedirect == evaluatedFrontendHostName;
message = "frontend redirect does not target the canonical host";
}
{
passed = frontendRedirectVirtualHost.forceSSL;
message = "frontend redirect does not force HTTPS";
}
{
passed = frontendRedirectVirtualHost.enableACME;
message = "frontend redirect does not enable ACME";
}
{
passed = backupConfig.repo == "ssh://mgjjruz9@mgjjruz9.repo.borgbase.com/./repo";
message = "Borg repository is not the Rabbi Gerzi repository";

View file

@ -120,12 +120,6 @@ in
description = "Frontend nginx virtual host name.";
};
redirectHostNames = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Frontend host names that redirect to the canonical host.";
};
publicUrl = lib.mkOption {
type = lib.types.str;
default = "https://${cfg.frontend.hostName}";
@ -409,13 +403,7 @@ in
recommendedProxySettings = lib.mkDefault true;
recommendedTlsSettings = lib.mkDefault true;
virtualHosts =
lib.genAttrs cfg.frontend.redirectHostNames (redirectHostName: {
enableACME = true;
forceSSL = true;
globalRedirect = cfg.frontend.hostName;
})
// {
virtualHosts = {
${cfg.frontend.hostName} = lib.mkMerge [
cfg.frontend.nginx
{