2017-02-28 16:15:20 +01:00
|
|
|
# verifies:
|
|
|
|
# 1. nginx generates config file with shared http context definitions above
|
|
|
|
# generated virtual hosts config.
|
|
|
|
|
|
|
|
import ./make-test.nix ({ pkgs, ...} : {
|
2017-08-11 17:37:14 +02:00
|
|
|
name = "nginx";
|
2017-02-28 16:15:20 +01:00
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ mbbx6spp ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
webserver =
|
2018-07-20 22:56:59 +02:00
|
|
|
{ ... }:
|
2017-02-28 16:15:20 +01:00
|
|
|
{ services.nginx.enable = true;
|
|
|
|
services.nginx.commonHttpConfig = ''
|
|
|
|
log_format ceeformat '@cee: {"status":"$status",'
|
|
|
|
'"request_time":$request_time,'
|
|
|
|
'"upstream_response_time":$upstream_response_time,'
|
|
|
|
'"pipe":"$pipe","bytes_sent":$bytes_sent,'
|
|
|
|
'"connection":"$connection",'
|
|
|
|
'"remote_addr":"$remote_addr",'
|
|
|
|
'"host":"$host",'
|
|
|
|
'"timestamp":"$time_iso8601",'
|
|
|
|
'"request":"$request",'
|
|
|
|
'"http_referer":"$http_referer",'
|
|
|
|
'"upstream_addr":"$upstream_addr"}';
|
|
|
|
'';
|
|
|
|
services.nginx.virtualHosts."0.my.test" = {
|
|
|
|
extraConfig = ''
|
|
|
|
access_log syslog:server=unix:/dev/log,facility=user,tag=mytag,severity=info ceeformat;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
|
|
|
$webserver->waitForUnit("nginx");
|
|
|
|
$webserver->waitForOpenPort("80");
|
|
|
|
'';
|
|
|
|
})
|