caddy: address remaining MR comments for v2
This commit is contained in:
parent
c3a7c89a20
commit
b8bfe941fa
|
@ -16,13 +16,15 @@ let
|
|||
};
|
||||
}];
|
||||
};
|
||||
adaptedConfig = importJSON (pkgs.runCommand "caddy-config-adapted.json" { } ''
|
||||
|
||||
adaptedConfig = pkgs.runCommand "caddy-config-adapted.json" { } ''
|
||||
${cfg.package}/bin/caddy adapt \
|
||||
--config ${configFile} --adapter ${cfg.adapter} > $out
|
||||
'');
|
||||
# TODO: validate with `caddy validate`?
|
||||
configJSON = pkgs.writeText "caddy-config.json" (builtins.toJSON
|
||||
(recursiveUpdate adaptedConfig tlsConfig));
|
||||
'';
|
||||
tlsJSON = pkgs.writeText "tls.json" (builtins.toJSON tlsConfig);
|
||||
configJSON = pkgs.runCommand "caddy-config.json" { } ''
|
||||
${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${adaptedConfig} ${tlsJSON} > $out
|
||||
'';
|
||||
in {
|
||||
options.services.caddy = {
|
||||
enable = mkEnableOption "Caddy web server";
|
||||
|
@ -114,7 +116,11 @@ in {
|
|||
-root=/var/tmp -conf=${configFile} \
|
||||
-ca=${cfg.ca} -email=${cfg.email} ${optionalString cfg.agree "-agree"}
|
||||
'';
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -USR1 $MAINPID";
|
||||
ExecReload =
|
||||
if isCaddy2 then
|
||||
"${cfg.package}/bin/caddy reload --config ${configJSON}"
|
||||
else
|
||||
"${pkgs.coreutils}/bin/kill -USR1 $MAINPID";
|
||||
Type = "simple";
|
||||
User = "caddy";
|
||||
Group = "caddy";
|
||||
|
|
|
@ -11,6 +11,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
http://localhost {
|
||||
encode gzip
|
||||
|
||||
file_server
|
||||
root * ${
|
||||
pkgs.runCommand "testdir" {} ''
|
||||
mkdir "$out"
|
||||
|
@ -25,6 +26,7 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
http://localhost {
|
||||
encode gzip
|
||||
|
||||
file_server
|
||||
root * ${
|
||||
pkgs.runCommand "testdir2" {} ''
|
||||
mkdir "$out"
|
||||
|
@ -59,9 +61,11 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
)
|
||||
etag = etag.replace("\r\n", " ")
|
||||
http_code = webserver.succeed(
|
||||
"curl -w \"%{{http_code}}\" -X HEAD -H 'If-None-Match: {}' {}".format(etag, url)
|
||||
"curl --silent --show-error -o /dev/null -w \"%{{http_code}}\" --head -H 'If-None-Match: {}' {}".format(
|
||||
etag, url
|
||||
)
|
||||
assert int(http_code) == 304, "HTTP code is not 304"
|
||||
)
|
||||
assert int(http_code) == 304, "HTTP code is {}, expected 304".format(http_code)
|
||||
return etag
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ buildGoModule rec {
|
|||
rev = "v${version}";
|
||||
sha256 = "0jrhwmr6gggppskg5h450wybzkv17iq69dgw36hd1dp56q002i7g";
|
||||
};
|
||||
modSha256 = "1gc0xvsihr4zp7hkrdfrplvzkaphz1y4q53rgwn2jhd8s98l57an";
|
||||
|
||||
vendorSha256 = "09vnci9pp8zp7bvn8zj68wslz2nc54nhcd0ll31sqfjbp00215mj";
|
||||
|
||||
preBuild = ''
|
||||
cat << EOF > caddy/main.go
|
||||
|
|
|
@ -1507,8 +1507,8 @@ in
|
|||
'';
|
||||
});
|
||||
|
||||
caddy = callPackage ../servers/caddy { };
|
||||
caddy1 = callPackage ../servers/caddy/v1.nix { };
|
||||
caddy = callPackage ../servers/caddy { buildGoModule = buildGo114Module; }; # https://github.com/lucas-clemente/quic-go/issues/2614
|
||||
caddy1 = callPackage ../servers/caddy/v1.nix { buildGoModule = buildGo114Module; };
|
||||
traefik = callPackage ../servers/traefik { };
|
||||
|
||||
calamares = libsForQt5.callPackage ../tools/misc/calamares {
|
||||
|
|
Loading…
Reference in a new issue