at 23.11-pre 2.2 kB view raw
1{ cfg }: 2{ config, lib, name, ... }: 3let 4 inherit (lib) literalExpression mkOption types; 5in 6{ 7 options = { 8 9 hostName = mkOption { 10 type = types.str; 11 default = name; 12 description = lib.mdDoc "Canonical hostname for the server."; 13 }; 14 15 serverAliases = mkOption { 16 type = with types; listOf str; 17 default = [ ]; 18 example = [ "www.example.org" "example.org" ]; 19 description = lib.mdDoc '' 20 Additional names of virtual hosts served by this virtual host configuration. 21 ''; 22 }; 23 24 listenAddresses = mkOption { 25 type = with types; listOf str; 26 description = lib.mdDoc '' 27 A list of host interfaces to bind to for this virtual host. 28 ''; 29 default = [ ]; 30 example = [ "127.0.0.1" "::1" ]; 31 }; 32 33 useACMEHost = mkOption { 34 type = types.nullOr types.str; 35 default = null; 36 description = lib.mdDoc '' 37 A host of an existing Let's Encrypt certificate to use. 38 This is mostly useful if you use DNS challenges but Caddy does not 39 currently support your provider. 40 41 *Note that this option does not create any certificates, nor 42 does it add subdomains to existing ones you will need to create them 43 manually using [](#opt-security.acme.certs).* 44 ''; 45 }; 46 47 logFormat = mkOption { 48 type = types.lines; 49 default = '' 50 output file ${cfg.logDir}/access-${config.hostName}.log 51 ''; 52 defaultText = '' 53 output file ''${config.services.caddy.logDir}/access-''${hostName}.log 54 ''; 55 example = literalExpression '' 56 mkForce ''' 57 output discard 58 '''; 59 ''; 60 description = lib.mdDoc '' 61 Configuration for HTTP request logging (also known as access logs). See 62 <https://caddyserver.com/docs/caddyfile/directives/log#log> 63 for details. 64 ''; 65 }; 66 67 extraConfig = mkOption { 68 type = types.lines; 69 default = ""; 70 description = lib.mdDoc '' 71 Additional lines of configuration appended to this virtual host in the 72 automatically generated `Caddyfile`. 73 ''; 74 }; 75 76 }; 77}