Repository navigation
fix: source notification-engine socket host from config, not a literal - #199
Open
princegupta1131 wants to merge 1 commit into
Open
princegupta1131 wants to merge 1 commit into
princegupta1131 wants to merge 1 commit into
Conversation
The previous commit hoisted 'http://notification-engine:3013' into a named constant, which moved the line without clearing Sonar's S5332 hotspot. The rule ignores localhost as non-routable and reports real hostnames: env.ts holds 42 http:// literals and this was the only one flagged. The routable hostname now comes from the env var or the untracked env.local-defaults.json, matching how every other internal address in this file is already sourced. No routable http:// literal remains in env.ts. The fallback stays a real value rather than undefined because server.ts passes it to ClientSocket(), and ClientSocket(undefined) silently connects to the process origin instead of failing - a refused connection to localhost is easier to diagnose than a silent misroute. Reusing localhost:3013 made the literal appear three times, which tripped the duplicate-literal rule, so NETWORK_HUB_SERVICE_BACKEND and NOTIFICATION_ENGINE_API_BASE now share DEFAULT_LOCALHOST_3013 alongside DEFAULT_LOCALHOST_7001. Both resolve to the same values as before. Behaviour change limited to one case: with no env var and no local defaults file, the socket URL is now http://localhost:3013 instead of the hard-coded cluster hostname. The tracked env-file never set this var, so no deployed environment should be in that state - and one that is now fails visibly instead of connecting by accident of a hard-coded host. CHANGE 50 updated with the three-scenario resolution table. tsc, lint and build clean. Full Jest suite passes (224 suites, 3693 tests).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous commit hoisted 'http://notification-engine:3013' into a named constant, which moved the line without clearing Sonar's S5332 hotspot. The rule ignores localhost as non-routable and reports real hostnames: env.ts holds 42 http:// literals and this was the only one flagged.
The routable hostname now comes from the env var or the untracked env.local-defaults.json, matching how every other internal address in this file is already sourced. No routable http:// literal remains in env.ts.
The fallback stays a real value rather than undefined because server.ts passes it to ClientSocket(), and ClientSocket(undefined) silently connects to the process origin instead of failing - a refused connection to localhost is easier to diagnose than a silent misroute.
Reusing localhost:3013 made the literal appear three times, which tripped the duplicate-literal rule, so NETWORK_HUB_SERVICE_BACKEND and NOTIFICATION_ENGINE_API_BASE now share DEFAULT_LOCALHOST_3013 alongside DEFAULT_LOCALHOST_7001. Both resolve to the same values as before.
Behaviour change limited to one case: with no env var and no local defaults file, the socket URL is now http://localhost:3013 instead of the hard-coded cluster hostname. The tracked env-file never set this var, so no deployed environment should be in that state - and one that is now fails visibly instead of connecting by accident of a hard-coded host. CHANGE 50 updated with the three-scenario resolution table.
tsc, lint and build clean. Full Jest suite passes (224 suites, 3693 tests).