pmcf 1.23.4 → 1.23.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,6 @@ const updates = [
16
16
  60000
17
17
  ].join(" ");
18
18
 
19
- const NAME_LEN = 35;
20
-
21
19
  await generateNamedDefs(owner, options.output);
22
20
 
23
21
  console.log("depends", "mf-named");
@@ -35,13 +33,15 @@ async function generateNamedDefs(owner, targetDir) {
35
33
  const nameserver = (await owner.service({ type: "dns" }))?.owner;
36
34
  const rname = dns.administratorEmail.replace(/@/, ".");
37
35
 
36
+ let maxKeyLength;
37
+
38
38
  const createRecord = (key, type, value) => {
39
39
  return {
40
40
  key,
41
41
  type,
42
42
  value,
43
43
  toString: () =>
44
- `${key.padEnd(NAME_LEN, " ")} ${ttl} IN ${type} ${value}`
44
+ `${key.padEnd(maxKeyLength, " ")} ${ttl} IN ${type.padEnd(5, " ")} ${value}`
45
45
  };
46
46
  };
47
47
 
@@ -148,7 +148,7 @@ async function generateNamedDefs(owner, targetDir) {
148
148
  if (zone !== catalogZone) {
149
149
  const hash = createHmac("md5", zone.id).digest("hex");
150
150
  catalogZone.records.add(
151
- `${hash}.zones.${domain}. IN PTR ${zone.id}.`
151
+ createRecord(`${hash}.zones.${domain}.`, "PTR", `${zone.id}.`)
152
152
  );
153
153
  }
154
154
 
@@ -165,6 +165,13 @@ async function generateNamedDefs(owner, targetDir) {
165
165
  zoneConfig.push(`};`);
166
166
  zoneConfig.push("");
167
167
 
168
+ maxKeyLength = 0;
169
+ for (const r of zone.records) {
170
+ if (r.key.length > maxKeyLength) {
171
+ maxKeyLength = r.key.length;
172
+ }
173
+ }
174
+
168
175
  writeLines(join(targetDir, "var/lib/named"), zone.file, zone.records);
169
176
  }
170
177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.23.4",
3
+ "version": "1.23.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/model.mjs CHANGED
@@ -938,7 +938,7 @@ export class Service extends Base {
938
938
 
939
939
  get srvPrefix() {
940
940
  const st = ServiceTypes[this.type];
941
- if (st) {
941
+ if (st?.protocol) {
942
942
  return `_${this.type}._${st.protocol}`;
943
943
  }
944
944
  }