[PR #245] Add ability to delete txt records #352

Open
opened 2026-03-13 16:19:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/acme-dns/acme-dns/pull/245
Author: @jacobmyers-codeninja
Created: 9/29/2020
Status: 🔄 Open

Base: masterHead: master


📝 Commits (2)

  • b08f083 Delete txt records (#1)
  • e328865 Actually call delete in /delete api (used update for testing)

📊 Changes

6 files changed (+466 additions, -48 deletions)

View changed files

📝 api.go (+36 -0)
📝 api_test.go (+250 -0)
📝 db.go (+28 -1)
📝 dns_test.go (+150 -47)
📝 main.go (+1 -0)
📝 types.go (+1 -0)

📄 Description

I wanted to be able to remove txt records after successful verification. I intend to be able to monitor domains in an automated fashion using scripts and watching for a lingering txt record on a domain indicates something is wrong somewhere and needs attention. In order to facilitate this I just added a new endpoint, to not mess with the existing public api in any way, and update the DB for the necessary functionality. Right now this fits in with minimal modification, the majority is duplicate code for test cases, and adds the ability for things like acme.sh to be able to remove records after validation.

  • Added /delete API endpoint to call DB.Delete, structured off /update - Functionally nearly identical with just some strings and the DB call adjusted.

  • Added test functions, structured off update tests, for the API for the delete endpoint.

  • Added DB.Delete function to DB to set the LastUpdate to 0 for the record being deleted.

  • Changed DB.GetTXTForDomain to only return records with LastUpdate > 0

  • Adjusted the test function TestResolveTXT to include tests for multiple records and deleting records. This update created a new function to reduce copy/paste, this code lives in hasExpectedResolveTXTs

  • Adjusted the test function hasExpectedTXTAnswer to handle checking for the correct number of records, and verifying all expected records are returned

My first time with go/working with github for stuff so apologies if I missed anything or did something wrong.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/acme-dns/acme-dns/pull/245 **Author:** [@jacobmyers-codeninja](https://github.com/jacobmyers-codeninja) **Created:** 9/29/2020 **Status:** 🔄 Open **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`b08f083`](https://github.com/acme-dns/acme-dns/commit/b08f0831a07347d4db4ed0f3b0a29010bb73c8d7) Delete txt records (#1) - [`e328865`](https://github.com/acme-dns/acme-dns/commit/e328865cd0dcf73605e949c1606c45865f86e9b9) Actually call delete in /delete api (used update for testing) ### 📊 Changes **6 files changed** (+466 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `api.go` (+36 -0) 📝 `api_test.go` (+250 -0) 📝 `db.go` (+28 -1) 📝 `dns_test.go` (+150 -47) 📝 `main.go` (+1 -0) 📝 `types.go` (+1 -0) </details> ### 📄 Description I wanted to be able to remove txt records after successful verification. I intend to be able to monitor domains in an automated fashion using scripts and watching for a lingering txt record on a domain indicates something is wrong somewhere and needs attention. In order to facilitate this I just added a new endpoint, to not mess with the existing public api in any way, and update the DB for the necessary functionality. Right now this fits in with minimal modification, the majority is duplicate code for test cases, and adds the ability for things like acme.sh to be able to remove records after validation. - Added /delete API endpoint to call DB.Delete, structured off /update - Functionally nearly identical with just some strings and the DB call adjusted. - Added test functions, structured off update tests, for the API for the delete endpoint. - Added DB.Delete function to DB to set the LastUpdate to 0 for the record being deleted. - Changed DB.GetTXTForDomain to only return records with LastUpdate > 0 - Adjusted the test function TestResolveTXT to include tests for multiple records and deleting records. This update created a new function to reduce copy/paste, this code lives in hasExpectedResolveTXTs - Adjusted the test function hasExpectedTXTAnswer to handle checking for the correct number of records, and verifying all expected records are returned My first time with go/working with github for stuff so apologies if I missed anything or did something wrong. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/acme-dns#352
No description provided.