Fix: Prevent duplicate header entries in Postfix config
Fix: Prevents duplicate entries in Postfix configuration files
Background
Each time the container was restarted, configuration lines were written multiple times to /etc/postfix/header_checks.
Changes
- Check for existing lines with
grep -qxF - Only add if line does not exist
- Structuring with variables for better maintainability
Test
- Multiple container restarts → no duplicates
- Functionality remains intact
Note
The method can be easily transferred to other configuration files.
Hello Juan Luis Baptiste,
While using your project, I noticed that certain configuration lines are written multiple times to the Postfix files each time the system is restarted. This leads to duplicates and potential problems when sending emails.
I have adjusted the code accordingly so that the entries are only added if they do not already exist. The changes are documented in a pull request:
👉 https://github.com/juanluisbaptiste/docker-postfix/pull/129
If you have any feedback or would like to make any additions, I am happy to hear from you.
Thank you for your work on the project!
Best regards,
Thomas
Hi @TWernthaler Thanks for your PR, I will review it and let you know.
Your code is touching a lot more things than what this fix should do. Please redo it to only include the code meant for this PR.