Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to delete txt records #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jacobmyers-codeninja
Copy link

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.

* Initial modifications to support delete
@coveralls
Copy link

coveralls commented Sep 29, 2020

Coverage Status

Coverage decreased (-0.2%) to 90.323% when pulling e328865 on jacobmyers-codeninja:master into 19069f5 on joohoi:master.

@jacobmyers-codeninja jacobmyers-codeninja changed the title Delete txt records (#1) Add ability to delete txt records Sep 29, 2020
@Yannik
Copy link
Contributor

Yannik commented Jul 16, 2021

I reviewed your PR, LTGM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants