Skip to content

Commit

Permalink
feat: preserve proxy configuration for DNS record (willswire#105)
Browse files Browse the repository at this point in the history
added proxy status

Signed-off-by: Robin <[email protected]>
  • Loading branch information
13robin37 authored Jan 3, 2025
1 parent 55c5a4b commit ac56b89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,17 @@ async function update(clientOptions: ClientOptions, newRecord: AddressableRecord
} else if (records.length === 0 || records[0].id === undefined) {
throw new HttpError(400, 'No record found! You must first manually create the record.');
}


// Extract the current `proxied` status
const currentRecord = records[0];
const proxied = currentRecord.proxied ?? false; // Default to `false` if `proxied` is undefined

await cloudflare.dns.records.update(records[0].id, {
content: newRecord.content,
zone_id: zone.id,
name: newRecord.name,
type: newRecord.type,
proxied, // Pass the existing "proxied" status
});

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

0 comments on commit ac56b89

Please sign in to comment.