chore: clean up caddy module
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
98833bdc6f
commit
628109e47e
1 changed files with 7 additions and 7 deletions
|
@ -4,18 +4,16 @@ self: {
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (self.lib) capitalise;
|
||||
|
||||
inherit (lib) types;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
inherit (lib.modules) mkIf mkOverride;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString stringLength substring toUpper;
|
||||
inherit (lib.strings) concatMapStringsSep concatStringsSep optionalString;
|
||||
|
||||
cfg = config.services.caddy;
|
||||
|
||||
capitalize = str:
|
||||
toUpper (substring 0 1 str)
|
||||
+ substring 1 (stringLength str) str;
|
||||
|
||||
mkSubDirConf = subOpts:
|
||||
optionalString (subOpts.reverseProxy != null) (
|
||||
if subOpts.experimental
|
||||
|
@ -27,7 +25,7 @@ self: {
|
|||
uri strip_prefix ${subOpts.subDirName}
|
||||
reverse_proxy ${subOpts.reverseProxy} {
|
||||
header_up X-Real-IP {remote}
|
||||
header_up X-${capitalize (subOpts.subDirName)}-Base "/${subOpts.subDirName}"
|
||||
header_up X-${capitalise subOpts.subDirName}-Base "/${subOpts.subDirName}"
|
||||
}
|
||||
}
|
||||
''
|
||||
|
@ -97,8 +95,10 @@ in {
|
|||
type = types.attrsOf (types.submodule (import ./vhost-options.nix {inherit cfg;}));
|
||||
};
|
||||
|
||||
# implementation
|
||||
config = mkIf cfg.enable {
|
||||
services.caddy.configFile = mkOverride 80 configFile;
|
||||
};
|
||||
|
||||
# For accurate stack trace
|
||||
_file = ./default.nix;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue