From 501fcfb90bd9fd4b0d5284232706f391a7fd7891 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:07:08 +0300 Subject: [PATCH] Added ability to have nicer BIND zone format --- automation/config.php.dist | 3 ++- automation/write-zone.php | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/automation/config.php.dist b/automation/config.php.dist index e923d22..c502ffc 100644 --- a/automation/config.php.dist +++ b/automation/config.php.dist @@ -45,7 +45,8 @@ return [ // ... more name servers as needed ... ], 'dns_soa' => 'hostmaster.example.com', - + 'zone_mode' => 'default', // nice is also available + // URS Configuration 'urs_imap_host' => '{your_imap_server:993/imap/ssl}INBOX', 'urs_imap_username' => 'your_username', diff --git a/automation/write-zone.php b/automation/write-zone.php index a9dc1de..c1cc569 100644 --- a/automation/write-zone.php +++ b/automation/write-zone.php @@ -7,6 +7,7 @@ use Badcow\DNS\Rdata\Factory; use Badcow\DNS\ResourceRecord; use Badcow\DNS\Classes; use Badcow\DNS\ZoneBuilder; +use Badcow\DNS\AlignedBuilder; $c = require_once 'config.php'; require_once 'helpers.php'; @@ -136,7 +137,11 @@ Coroutine::create(function () use ($pool, $log, $c) { } } - $builder = new ZoneBuilder(); + if (isset($c['zone_mode']) && $c['zone_mode'] === 'nice') { + $builder = new AlignedBuilder(); + } else { + $builder = new ZoneBuilder(); + } $completed_zone = $builder->build($zone); if ($c['dns_server'] == 'bind') {