Expand dyndns to cover muliple domains

This commit is contained in:
Peder Bergebakken Sundt 2023-06-23 21:14:55 +02:00
parent 8a7b7f01d8
commit b98a7da9cd
2 changed files with 10 additions and 5 deletions

View File

@ -79,7 +79,10 @@
../../profiles/autossh-reverse-tunnels
#../../profiles/xrdp
];
services.domeneshop-updater.target = "olavtr.pbsds.net";
services.domeneshop-updater.targets = [
"pbsds.net"
"olavtr.pbsds.net"
];
# TODO: remove? Move to where relevant?
nixpkgs.overlays = [

View File

@ -6,9 +6,9 @@ in
# auto domain update
options = with lib; {
services.domeneshop-updater.target = mkOption {
type = types.str; #TODO list of string
#default = config.networking.fqdn;
services.domeneshop-updater.targets = mkOption {
type = with types; listOf str;
#default = [ config.networking.fqdn ];
};
};
@ -30,7 +30,9 @@ in
}
DOMENESHOP_TOKEN="$( tomlq </var/lib/secrets/domeneshop.toml .secrets.DOMENESHOP_TOKEN --raw-output)"
DOMENESHOP_SECRET="$(tomlq </var/lib/secrets/domeneshop.toml .secrets.DOMENESHOP_SECRET --raw-output)"
curl https://"$DOMENESHOP_TOKEN":"$DOMENESHOP_SECRET"@api.domeneshop.no/v0/dyndns/update?hostname=${cfg.target}
${lib.concatMapStringsSep "\n" (target: ''
curl https://"$DOMENESHOP_TOKEN":"$DOMENESHOP_SECRET"@api.domeneshop.no/v0/dyndns/update?hostname=${target}
'') cfg.targets}
'';
};
in {