Skip to content

Commit

Permalink
fix: wrong origin parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
imcatwhocode committed Dec 19, 2024
1 parent 3aa55a9 commit bd86db9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ZONE_INT_NS=ns1.example.network.,ns2.example.network.
# Required.
ZONE_RDNS_PREFIX=10.0.

ZONE_RDNS_DOMAIN=int.example.network
ZONE_RDNS_DOMAIN=int.example.network.
ZONE_RDNS_IFACE=internal
ZONE_RDNS_STATIC_ONLY=false
ZONE_RDNS_TYPE=rdns
Expand Down
11 changes: 6 additions & 5 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ function parseZoneConfiguration (outDir: string, key: string): Zone {
}

if (zoneType === ZoneType.Default) {
const fqdn = result[`ZONE_${key}_DOMAIN`].replace(/\.$/, '')
return {
domain: result[`ZONE_${key}_DOMAIN`],
interface: result[`ZONE_${key}_IFACE`],
key,
origin: result[`ZONE_${key}_DOMAIN`].replace(/\.$/, ''),
outFile: resolve(outDir, `db.${result[`ZONE_${key}_DOMAIN`].replace(/\.$/, '')}`),
origin: `${fqdn}.`,
outFile: resolve(outDir, `db.${fqdn}`),
records: result[`ZONE_${key}_INCLUDE`],
soa: {
nameServers: result[`ZONE_${key}_NS`],
Expand All @@ -95,13 +96,13 @@ function parseZoneConfiguration (outDir: string, key: string): Zone {
} satisfies DefaultZone
}

const origin = result[`ZONE_${key}_PREFIX`].replace(/\.$/, '').split('.').reverse().join('.').concat('.in-addr.arpa')
const fqdn = result[`ZONE_${key}_PREFIX`].replace(/\.$/, '').split('.').reverse().join('.').concat('.in-addr.arpa')
return {
domain: result[`ZONE_${key}_DOMAIN`],
interface: result[`ZONE_${key}_IFACE`],
key,
origin,
outFile: resolve(outDir, `db.${origin}`),
origin: `${fqdn}.`,
outFile: resolve(outDir, `db.${fqdn}`),
ptrSubnet: result[`ZONE_${key}_PREFIX`],
soa: {
nameServers: result[`ZONE_${key}_NS`],
Expand Down

0 comments on commit bd86db9

Please sign in to comment.