Repository navigation
feat: accept a Unix socket path as the MySQL/MariaDB and PostgreSQL host - #684
Conversation
The host validation added in #511 rejects `/`, so a PostgreSQL server using a socket directory could no longer be saved, although its backups kept running. PostgreSQL only needed validation to accept the path, since libpq reads a host starting with `/` as a socket directory. MySQL/MariaDB clients need `--socket` (with an explicit `--host=localhost`, or a MYSQL_HOST in the environment switches them back to TCP) and `unix_socket=` in the PDO DSN. Closes #682
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (9)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (1)
🧰 Additional context used🪛 PHPMD (2.15.0)app/Rules/SafeHost.php[warning] 34-34: Avoid unused parameters such as '$attribute'. (undefined) (UnusedFormalParameter) 🔇 Additional comments (9)
📝 WalkthroughWalkthroughThe change adds database-type-aware validation for Unix socket host paths. MySQL backup commands and PDO connections use socket settings for those hosts. Adminer receives MySQL socket hosts in its server credential. ChangesUnix Socket Host Support
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to This change lets Unix socket hosts be saved and used for PostgreSQL and MySQL/MariaDB connections. No merge-blocking risk was identified in the supplied changes. Agents on version 1.9 or earlier will still fail to connect to a MySQL socket host, which the author notes calls for a minor release. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks a socket path, Comment |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (89.74%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #684 +/- ##
============================================
- Coverage 92.18% 92.11% -0.07%
- Complexity 3513 3531 +18
============================================
Files 300 300
Lines 11958 11979 +21
============================================
+ Hits 11023 11035 +12
- Misses 935 944 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The host validation added in #511 rejects
/, so a PostgreSQL server pointing at a socket directory could no longer be saved, even though its backups kept running. PostgreSQL only needed validation to accept the path, since libpq reads a host starting with/as a socket directory.MySQL/MariaDB is the most used engine, so it gets the same support here. Its clients need
--socket, and the PDO DSN needsunix_socket=.--host=localhostis passed alongside--socketbecause aMYSQL_HOSTin the environment (or an option file) otherwise makes both clients ignore the socket and go over TCP.Checked end to end against MySQL 8.4, MariaDB 11.8 and PostgreSQL 17, each sharing its socket with the app image through a Docker volume: connection test, database listing, restore and dump all work, including with
MYSQL_HOSTset.Things worth knowing:
--host=/pathfor a MySQL socket server and fail to connect, so this belongs in a minor release.Closes #682
Summary by CodeRabbit