feat: add support for extra_records_path in hs config

This commit is contained in:
Aarnav Tale
2025-04-26 13:25:14 -04:00
parent 81feb2f19a
commit 021ecabd3c
8 changed files with 273 additions and 23 deletions
+17 -17
View File
@@ -194,16 +194,16 @@ async function removeRecord(formData: FormData, context: LoadContext) {
return data({ success: false }, 400);
}
const records = config.dns.extra_records.filter(
(i) => i.name !== recordName || i.type !== recordType,
);
// Value is not needed for removal
const restart = await context.hs.removeDNS({
name: recordName,
type: recordType,
value: '',
});
await context.hs.patch([
{
path: 'dns.extra_records',
value: records,
},
]);
if (!restart) {
return;
}
await context.integration?.onConfigChange(context.client);
}
@@ -218,15 +218,15 @@ async function addRecord(formData: FormData, context: LoadContext) {
return data({ success: false }, 400);
}
const records = config.dns.extra_records;
records.push({ name: recordName, type: recordType, value: recordValue });
const restart = await context.hs.addDNS({
name: recordName,
type: recordType,
value: recordValue,
});
await context.hs.patch([
{
path: 'dns.extra_records',
value: records,
},
]);
if (!restart) {
return;
}
await context.integration?.onConfigChange(context.client);
}
+1 -1
View File
@@ -44,7 +44,7 @@ export async function loader({
nameservers: config.dns.nameservers.global,
splitDns: config.dns.nameservers.split,
searchDomains: config.dns.search_domains,
extraRecords: config.dns.extra_records,
extraRecords: context.hs.d,
};
return {