Skip to content

Commit

Permalink
cloudflared: support passing extra args
Browse files Browse the repository at this point in the history
  • Loading branch information
hazelmeow committed Jan 11, 2025
1 parent 29b8294 commit e0750fe
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion nixos/modules/services/networking/cloudflared.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config,
lib,
pkgs,
utils,
...
}:
let
Expand Down Expand Up @@ -269,6 +270,27 @@ in
default = "http_status:404";
};
};

};

extraGlobalArgs = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
example = [ "--loglevel" "debug" ];
description = ''
Extra arguments to pass to cloudflared
that are common to all tunnel subcommands.
'';
};

extraRunArgs = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
example = [ "--post-quantum" ];
description = ''
Extra arguments to pass to cloudflared
that are specific to the run subcommand.
'';
};
};

Expand Down Expand Up @@ -336,7 +358,17 @@ in
serviceConfig = {
User = cfg.user;
Group = cfg.group;
ExecStart = "${cfg.package}/bin/cloudflared tunnel --config=${mkConfigFile} --no-autoupdate run";
ExecStart = utils.escapeSystemdExecArgs (
[
"${cfg.package}/bin/cloudflared"
"tunnel"
"--config=${mkConfigFile}"
"--no-autoupdate"
]
++ cfg.extraGlobalArgs
++ ["run"]
++ cfg.extraRunArgs
);
Restart = "on-failure";
};
})
Expand Down

0 comments on commit e0750fe

Please sign in to comment.