aboutsummaryrefslogtreecommitdiff
path: root/src/dns_config.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-11 16:29:06 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-11 16:29:06 +0100
commitb26d4d7bbad7c77f466a00f0bd21e7e4ea09c3b1 (patch)
tree0894d7de36ec28e20f36311c5144959d6f604343 /src/dns_config.rs
parent0d37299b24ec112b752b81334e35bac8c2c36167 (diff)
downloadD53-b26d4d7bbad7c77f466a00f0bd21e7e4ea09c3b1.tar.gz
D53-b26d4d7bbad7c77f466a00f0bd21e7e4ea09c3b1.zip
Change label format to be a single dns path
Diffstat (limited to 'src/dns_config.rs')
-rw-r--r--src/dns_config.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/dns_config.rs b/src/dns_config.rs
index 25cc5f0..37a49fa 100644
--- a/src/dns_config.rs
+++ b/src/dns_config.rs
@@ -26,8 +26,7 @@ pub struct DnsConfig {
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct DnsEntryKey {
- pub domain: String,
- pub subdomain: String,
+ pub dns_path: String,
pub record_type: DnsRecordType,
}
@@ -62,7 +61,7 @@ impl DnsConfig {
fn parse_d53_tag(tag: &str, node: &ConsulNode) -> Option<(DnsEntryKey, DnsEntryValue)> {
let splits = tag.split(' ').collect::<Vec<_>>();
- if splits.len() != 3 {
+ if splits.len() != 2 {
return None;
}
@@ -96,8 +95,7 @@ fn parse_d53_tag(tag: &str, node: &ConsulNode) -> Option<(DnsEntryKey, DnsEntryV
Some((
DnsEntryKey {
- domain: splits[1].to_string(),
- subdomain: splits[2].to_string(),
+ dns_path: splits[1].to_string(),
record_type,
},
DnsEntryValue { targets },
@@ -259,11 +257,7 @@ impl std::fmt::Display for DnsRecordType {
impl std::fmt::Display for DnsEntryKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(
- f,
- "{}.{} IN {}",
- self.subdomain, self.domain, self.record_type
- )
+ write!(f, "{} IN {}", self.dns_path, self.record_type)
}
}