2024-05-09 15:20:03 +02:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let cfg = config.satellite.cloudflared;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.satellite.cloudflared = {
|
|
|
|
tunnel = lib.mkOption {
|
|
|
|
type = lib.types.string;
|
|
|
|
description = "Cloudflare tunnel id to use for the `satellite.cloudflared.proxy` helper";
|
|
|
|
};
|
|
|
|
|
|
|
|
proxy = lib.mkOption {
|
|
|
|
type = lib.types.functionTo (lib.types.functionTo lib.types.anything);
|
|
|
|
description = "Helper function for generating a quick proxy config";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-09 15:24:28 +02:00
|
|
|
config.satellite.cloudflared.proxy = from: port: {
|
2024-05-09 15:20:03 +02:00
|
|
|
${cfg.tunnel} = {
|
|
|
|
ingress.${from} = "http://localhost${toString port}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|