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

Closed
opened 2026-02-26 12:11:04 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/0xJacky/nginx-ui/pull/1414
Author: @enwikuna
Created: 10/29/2025
Status: Merged
Merged: 11/25/2025
Merged by: @0xJacky

Base: devHead: patch-1


📝 Commits (2)

  • 8b565a4 Refactor nginx path resolution with improved regex and fallback
  • f5df9be enhance: nginx path parsing and add tests #1412, #1414

📊 Changes

3 files changed (+212 additions, -52 deletions)

View changed files

📝 api/cluster/node.go (+1 -8)
📝 internal/nginx/resolve_path.go (+110 -44)
internal/nginx/resolve_path_test.go (+101 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/0xJacky/nginx-ui/pull/1414 **Author:** [@enwikuna](https://github.com/enwikuna) **Created:** 10/29/2025 **Status:** ✅ Merged **Merged:** 11/25/2025 **Merged by:** [@0xJacky](https://github.com/0xJacky) **Base:** `dev` ← **Head:** `patch-1` --- ### 📝 Commits (2) - [`8b565a4`](https://github.com/0xJacky/nginx-ui/commit/8b565a423f1db9d87478c17dfa623ce9dfe8afa6) Refactor nginx path resolution with improved regex and fallback - [`f5df9be`](https://github.com/0xJacky/nginx-ui/commit/f5df9be6496fa38ea8baaf35aa6726d8af68f5ea) enhance: nginx path parsing and add tests #1412, #1414 ### 📊 Changes **3 files changed** (+212 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `api/cluster/node.go` (+1 -8) 📝 `internal/nginx/resolve_path.go` (+110 -44) ➕ `internal/nginx/resolve_path_test.go` (+101 -0) </details> ### 📄 Description 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 --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 12:11:04 +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#1283
No description provided.