[reverse proxy] Use getApiBase() to get GraphQL Endpoint for events#1397
[reverse proxy] Use getApiBase() to get GraphQL Endpoint for events#1397jokob-sk merged 3 commits intonetalertx:mainfrom
Conversation
📝 WalkthroughWalkthroughThree PHP files replace manual API endpoint construction using protocol/host/port with a centralized Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
front/deviceDetailsTools.php (3)
221-222: Remove redundant apiBase declaration.The
apiBaseconstant is already declared at the top level (lines 213-214) and is accessible throughout the script. This redeclaration creates unnecessary variable shadowing.♻️ Proposed fix
- // Build base URL dynamically - const apiBase = getApiBase(); -
586-587: Remove redundant apiBase and apiToken declarations.Both constants are already declared at the top level (lines 213-215). The redeclaration is unnecessary and creates variable shadowing.
♻️ Proposed fix
- // Build base URL dynamically - const apiBase = getApiBase(); - const apiToken = getSetting("API_TOKEN"); // optional token if needed -
637-638: Remove redundant apiBase declaration.The
apiBaseconstant is already declared at the top level (lines 213-214). This redeclaration creates unnecessary variable shadowing.♻️ Proposed fix
- // Build base URL dynamically - const apiBase = getApiBase(); -
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
front/appEventsCore.phpfront/deviceDetailsTools.phpfront/events.php
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{py,php,js}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use environment variables (
NETALERTX_DB,NETALERTX_LOG, etc.) everywhere instead of hardcoding/data/dbor relative paths. Use/datafor persistent config/db,/tmpfor runtime logs/api/nginx state
Files:
front/deviceDetailsTools.phpfront/events.phpfront/appEventsCore.php
🔇 Additional comments (5)
front/appEventsCore.php (1)
27-28: LGTM! Clean centralization of API base URL.The introduction of
getApiBase()properly abstracts the API endpoint construction, making it reverse-proxy friendly. The variable naming is consistent with other files in this PR.front/events.php (2)
163-166: LGTM! Consistent API base URL handling.The centralized
getApiBase()approach properly supports reverse proxy configurations. The comment on line 163 helps document the change.
209-211: LGTM! Consistent pattern with getEventsTotals.The API base URL construction matches the pattern established in
getEventsTotals(), ensuring consistency across event-related endpoints.front/deviceDetailsTools.php (2)
213-214: LGTM! Centralized API configuration.The top-level
apiBaseandapiTokendeclarations provide a single source of truth for API configuration across all tool functions.
226-256: LGTM! Proper use of centralized API base.The nmap scan function correctly uses the centralized
apiBasefor endpoint construction with proper error handling and response formatting.
Use
getApiBase()to get GraphQL Endpoint forfront/appEventsCore.phpandfront/events.php.Note that you might want to check the Variable Names and see if
baseUrlorapiBaseis preferrable to you (it might not be fully consistent with the rest of the Code).Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.