App-DDFlare
view release on metacpan or search on metacpan
script/ddflare view on Meta::CPAN
Subsequent elements are { zone => ..., domains => [ ... ] } which are
cloudflare zones, and the subdomains within them to update. An
undefined value in domains represents the zone itself.
loadConfig($PATH_TO_CONFIG);
=cut
sub loadConfig {
say "Loading config from $CONFIG_FILE" if $VERBOSE;
LoadFile($CONFIG_FILE);
}
# Get cloudflare settings and zone info
my @conf = loadConfig();
# How long to wait before updates, seconds
Readonly my $UPDATE_INTERVAL => 300;
Readonly my $updater => Net::DNS::CloudFlare::DDNS->new(
user => $conf[0]{user},
apikey => $conf[0]{key},
zones => [ @conf[1 .. $#conf] ],
verbose => $VERBOSE
);
# We are a daemon
while(1) {
$updater->update;
say "Going to sleep for $UPDATE_INTERVAL seconds" if $VERBOSE;
# Don't check too often!
sleep $UPDATE_INTERVAL;
}
=head1 AUTHOR
Peter Roberts, C<< <me+ddflare at peter-r.co.uk> >>
=head1 COPYRIGHT/LICENSE
( run in 0.441 second using v1.01-cache-2.11-cpan-a1f116cd669 )