Skip to content

Commit ac56b89

Browse files
authored
feat: preserve proxy configuration for DNS record (willswire#105)
added proxy status Signed-off-by: Robin <robin@vieregge.info>
1 parent 55c5a4b commit ac56b89

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,17 @@ async function update(clientOptions: ClientOptions, newRecord: AddressableRecord
8484
} else if (records.length === 0 || records[0].id === undefined) {
8585
throw new HttpError(400, 'No record found! You must first manually create the record.');
8686
}
87-
87+
88+
// Extract the current `proxied` status
89+
const currentRecord = records[0];
90+
const proxied = currentRecord.proxied ?? false; // Default to `false` if `proxied` is undefined
91+
8892
await cloudflare.dns.records.update(records[0].id, {
8993
content: newRecord.content,
9094
zone_id: zone.id,
9195
name: newRecord.name,
9296
type: newRecord.type,
97+
proxied, // Pass the existing "proxied" status
9398
});
9499

95100
return new Response('OK', { status: 200 });

0 commit comments

Comments
 (0)