Skip to content

Commit

Permalink
feat: [noticket] add option for caddy ports
Browse files Browse the repository at this point in the history
  • Loading branch information
lx-wnk committed Oct 24, 2023
1 parent 0a9c56f commit 14d58c5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
12 changes: 12 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ in {
default = false;
description = ''Enables MySQL binary logs'';
};

httpPort = lib.mkOption {
type = lib.types.bool;
default = 80;
description = ''Sets the HTTP port'';
};

httpsPort = lib.mkOption {
type = lib.types.bool;
default = 443;
description = ''Sets the HTTPS port'';
};
};

config = lib.mkIf cfg.enable {
Expand Down
16 changes: 16 additions & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,19 @@ Enables the MySQL Binary Log and adds configuration for it.
```
kellerkinder.enableMysqlBinLog = false;
```

# kellerkinder.httpPort
Sets the http port for caddy.

*_Example_*
```
kellerkinder.httpPort = 8080;
```

# kellerkinder.httpsPort
Sets the https port for caddy.

*_Example_*
```
kellerkinder.httpsPort = 8443;
```
4 changes: 2 additions & 2 deletions modules/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ let
})));

caddyHostConfig = (lib.mkMerge (lib.forEach vhostDomains (domain: {
"${toString domain}:80" = lib.mkDefault {
"${toString domain}:${cfg.httpPort}" = lib.mkDefault {
extraConfig = vhostConfig;
};
"${toString domain}:443" = lib.mkDefault {
"${toString domain}:${cfg.httpsPort}" = lib.mkDefault {
extraConfig = vhostConfigSSL;
};
})));
Expand Down

0 comments on commit 14d58c5

Please sign in to comment.