$clon = $clon + 360;
}
- $zonefile->print("# $origin->{name}\n");
- $zonefile->print("C\L$origin->{code}\E.${zone}:$cluster->{name}.${zone}:600\n");
+ if (!defined($gdnsname))
+ {
+ $zonefile->print("# $origin->{name}\n");
+ $zonefile->print("C\L$origin->{code}\E.${zone}:$cluster->{name}.${zone}:600\n");
- $jszonefile->print(" CNAME(\"\L$origin->{code}\E.${jszone}\", \"$cluster->{name}.${zone}.\", TTL(\"10m\")),\n");
+ $jszonefile->print(" CNAME(\"\L$origin->{code}\E.${jszone}\", \"$cluster->{name}.${zone}.\", TTL(\"10m\")),\n");
+ }
push @json, {
type => "Feature",
$targetorigins->{$cluster->{name}}->{bandwidth} += $origin->{bandwidth};
}
-# Header for default records
-$zonefile->print("# Unknown origins\n");
-
-# Output default records for IPs that can't be mapped to a country
-foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters)
+# Skip default records if we don't need them
+if (!defined($gdnsname))
{
- my $name = $cluster->{name};
+ # Header for default records
+ $zonefile->print("# Unknown origins\n");
- if (my $default = $cluster->{default})
- {
- output_server($zonefile, $jszonefile, "${default}.${zone}", "${default}.${jszone}", $cluster);
- }
- elsif (exists($cluster->{default}))
+ # Output default records for IPs that can't be mapped to a country
+ foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters)
{
- output_server($zonefile, $jszonefile, "${zone}", "${jszone}", $cluster);
+ my $name = $cluster->{name};
+
+ if (my $default = $cluster->{default})
+ {
+ output_server($zonefile, $jszonefile, "${default}.${zone}", "${default}.${jszone}", $cluster);
+ }
+ elsif (exists($cluster->{default}))
+ {
+ output_server($zonefile, $jszonefile, "${zone}", "${jszone}", $cluster);
+ }
}
}