[PR #1414] Refactor nginx path resolution with improved regex and fallback #5710

Closed
opened 2026-03-01 15:42:22 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/0xJacky/nginx-ui/pull/1414

State: closed
Merged: Yes


Updated regex patterns for extracting nginx configuration paths and added fallback mechanisms for determining paths on different operating systems. Improved error handling and logging for better debugging.

If we have helped you, please leave our company a nice review: https://g.page/r/CaNMAPSpl68TEBM/review


Note

Refactors nginx path resolution to use a robust flag parser with fallbacks and tests, and simplifies node listing handler.

  • nginx path resolution:
    • Introduce extractConfigureArg to parse nginx -V flags.
    • Replace regex parsing across GetPrefix, GetConfPath, GetConfEntryPath, GetPIDPath, GetAccessLogPath, GetErrorLogPath, and GetModulesPath.
    • Add robust fallbacks (Windows handling, default dirs, PID probing in common locations) and improved logging.
  • Tests:
    • Add internal/nginx/resolve_path_test.go covering flag extraction (quoted/unquoted) and paths with spaces; validate GetConfPath, GetConfEntryPath, and GetPIDPath.
  • API:
    • Simplify GetNodeList in api/cluster/node.go to use core.List() with transformer.

Written by Cursor Bugbot for commit f5df9be649. This will update automatically on new commits. Configure here.

**Original Pull Request:** https://github.com/0xJacky/nginx-ui/pull/1414 **State:** closed **Merged:** Yes --- Updated regex patterns for extracting nginx configuration paths and added fallback mechanisms for determining paths on different operating systems. Improved error handling and logging for better debugging. If we have helped you, please leave our company a nice review: https://g.page/r/CaNMAPSpl68TEBM/review <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Refactors nginx path resolution to use a robust flag parser with fallbacks and tests, and simplifies node listing handler. > > - **nginx path resolution**: > - Introduce `extractConfigureArg` to parse `nginx -V` flags. > - Replace regex parsing across `GetPrefix`, `GetConfPath`, `GetConfEntryPath`, `GetPIDPath`, `GetAccessLogPath`, `GetErrorLogPath`, and `GetModulesPath`. > - Add robust fallbacks (Windows handling, default dirs, PID probing in common locations) and improved logging. > - **Tests**: > - Add `internal/nginx/resolve_path_test.go` covering flag extraction (quoted/unquoted) and paths with spaces; validate `GetConfPath`, `GetConfEntryPath`, and `GetPIDPath`. > - **API**: > - Simplify `GetNodeList` in `api/cluster/node.go` to use `core.List()` with transformer. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f5df9be6496fa38ea8baaf35aa6726d8af68f5ea. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
kerem 2026-03-01 15:42:22 +03:00
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/nginx-ui#5710
No description provided.