fix: try to move GetCertificate to internal/tls

What does this MR do?

This MR moves the certificate retrieval logic from app.go to the internal/tls package to improve code organization and reduce coupling between packages. It also enhances robustness and maintainability through improved error handling, logging, and documentation.


Why was this MR needed?

  • Improve code organization by placing TLS-related functionality in a dedicated package
  • Reduce coupling between packages
  • Enhance readability and maintainability
  • Ensure better test coverage and error visibility

Implementation details

  • Added GetCertificateForDomain function to handle domain certificate retrieval
  • Extracted anonymous logic into a named method for improved clarity
  • Added proper error handling with structured logging
  • Updated GetTLSConfig to use domain lookup function
  • Fixed import issues and type mismatches
  • Added a specific test for GetCertificateForDomain
  • Fixed previously failing acceptance tests
  • Added comprehensive inline documentation

Testing

  • Unit tests pass: go test ./internal/tls/...
  • Integration tests pass: go test ./test/...
  • All tests pass: make test
  • New tests added for core logic

Documentation

  • Updated code comments with comprehensive explanations
  • 📄 No external documentation changes needed
Edited by Mohammed Firdous

Merge request reports

Loading