nixos/caddy: Fix default log file for http:// hostnames (#371802)
This commit is contained in:
commit
24a8c64c2b
@ -58,7 +58,7 @@ in
|
|||||||
logFormat = mkOption {
|
logFormat = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = ''
|
default = ''
|
||||||
output file ${cfg.logDir}/access-${config.hostName}.log
|
output file ${cfg.logDir}/access-${lib.replaceStrings [ "/" " " ] [ "_" "_" ] config.hostName}.log
|
||||||
'';
|
'';
|
||||||
defaultText = ''
|
defaultText = ''
|
||||||
output file ''${config.services.caddy.logDir}/access-''${hostName}.log
|
output file ''${config.services.caddy.logDir}/access-''${hostName}.log
|
||||||
|
|||||||
@ -41,6 +41,11 @@ import ./make-test-python.nix (
|
|||||||
"http://localhost:8081" = { };
|
"http://localhost:8081" = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
specialisation.multiple-hostnames.configuration = {
|
||||||
|
services.caddy.virtualHosts = {
|
||||||
|
"http://localhost:8080 http://localhost:8081" = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
specialisation.rfc42.configuration = {
|
specialisation.rfc42.configuration = {
|
||||||
services.caddy.settings = {
|
services.caddy.settings = {
|
||||||
apps.http.servers.default = {
|
apps.http.servers.default = {
|
||||||
@ -70,7 +75,7 @@ import ./make-test-python.nix (
|
|||||||
services.caddy = {
|
services.caddy = {
|
||||||
package = pkgs.caddy.withPlugins {
|
package = pkgs.caddy.withPlugins {
|
||||||
plugins = [ "github.com/caddyserver/replace-response@v0.0.0-20241211194404-3865845790a7" ];
|
plugins = [ "github.com/caddyserver/replace-response@v0.0.0-20241211194404-3865845790a7" ];
|
||||||
hash = "sha256-zgMdtOJbmtRSfTlrrg8njr11in2C7OAXLB+34V23jek=";
|
hash = "sha256-BorJJWICgAWU7DrpDZJWifMnIYtGWldt/4S1VELwGJI=";
|
||||||
};
|
};
|
||||||
configFile = pkgs.writeText "Caddyfile" ''
|
configFile = pkgs.writeText "Caddyfile" ''
|
||||||
{
|
{
|
||||||
@ -93,6 +98,7 @@ import ./make-test-python.nix (
|
|||||||
explicitConfigFile = "${nodes.webserver.system.build.toplevel}/specialisation/explicit-config-file";
|
explicitConfigFile = "${nodes.webserver.system.build.toplevel}/specialisation/explicit-config-file";
|
||||||
justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload";
|
justReloadSystem = "${nodes.webserver.system.build.toplevel}/specialisation/config-reload";
|
||||||
multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs";
|
multipleConfigs = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-configs";
|
||||||
|
multipleHostnames = "${nodes.webserver.system.build.toplevel}/specialisation/multiple-hostnames";
|
||||||
rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";
|
rfc42Config = "${nodes.webserver.system.build.toplevel}/specialisation/rfc42";
|
||||||
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins";
|
withPluginsConfig = "${nodes.webserver.system.build.toplevel}/specialisation/with-plugins";
|
||||||
in
|
in
|
||||||
@ -117,6 +123,13 @@ import ./make-test-python.nix (
|
|||||||
webserver.wait_for_open_port(8080)
|
webserver.wait_for_open_port(8080)
|
||||||
webserver.wait_for_open_port(8081)
|
webserver.wait_for_open_port(8081)
|
||||||
|
|
||||||
|
with subtest("a virtual host with multiple hostnames works"):
|
||||||
|
webserver.succeed(
|
||||||
|
"${multipleHostnames}/bin/switch-to-configuration test >&2"
|
||||||
|
)
|
||||||
|
webserver.wait_for_open_port(8080)
|
||||||
|
webserver.wait_for_open_port(8081)
|
||||||
|
|
||||||
with subtest("rfc42 settings config"):
|
with subtest("rfc42 settings config"):
|
||||||
webserver.succeed(
|
webserver.succeed(
|
||||||
"${rfc42Config}/bin/switch-to-configuration test >&2"
|
"${rfc42Config}/bin/switch-to-configuration test >&2"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user