summary refs log tree commit diff stats
path: root/system/settings/dev.nix
blob: 7d2e6193f5d53893fc0a2fccd18f9189977a71e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ ... }: {
  services.caddy = {
    enable = true;
    globalConfig = ''
      auto_https disable_redirects
    '';
    virtualHosts =
      let
        local_tls = ''
          tls {
            issuer internal {
              ca local
            }
          }
        '';
      in
      {
        "localhost" = {
          logFormat = "output discard";
          extraConfig = ''
            ${local_tls}
            acme_server {
              allow {
                domains *.test *.localhost
              }
            }
          '';
        };
        # need to test forwarding behaviour
        "https://alanpearce.localhost" = {
          logFormat = "output discard";
          serverAliases = [
            "http://alanpearce.localhost"

            # remember to update /etc/hosts
            "https://alanpearce.test"
            "http://alanpearce.test"
          ];
          extraConfig = ''
            ${local_tls}
            reverse_proxy http://alanpearce.test:8080 {
              transport http {
                dial_timeout 1s
                compression off
              }
            }
          '';
        };
        "searchix.localhost" = {
          logFormat = "output discard";
          extraConfig = ''
            reverse_proxy http://localhost:7331 {
              transport http {
                dial_timeout 1s
                compression off
              }
            }
          '';
        };
      };
  };
}