Auto-detect APIView environment from URL domain#14569
Auto-detect APIView environment from URL domain#14569swathipil wants to merge 2 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Why are we doing this change to identify apiview host? apiview staging should be used only for development and testing purpose. right? All other uses cases (once this feature is available to users) must use production URL and production host.
Why don't we simply use an env variable to override the host in Apiview http service class. If AZSDK_APIVIEW_HOST_NAME env variable is present and it has value then use it as host name. Otherwise just use the default apiview url.
If someone wants to test with a different APIView instance than production instance, they should just set the env variable.
praveenkuttappan
left a comment
There was a problem hiding this comment.
I don't think this change is required other than providing a simple env var to override the host name, mcp tool is connecting to.
closing #13656 in favor of this.
The
azsdk_apiview_get_commentstool required users to manually setAPIVIEW_ENVIRONMENTto match the URL's target environment. Queryingapiviewstagingtest.comwith defaultproductionenvironment returned empty results.Changes
Added domain-based detection in
APIViewReviewTool.GetEnvironmentFromUrl():apiviewstagingtest.com→ staginglocalhost→ localAPIVIEW_ENVIRONMENToverride preserved (takes precedence)Threading environment through call chain:
APIViewReviewToolextracts environment from URL, passes downstreamIAPIViewService.GetCommentsByRevisionAsync/GetRevisionContentaccept environment parameterIAPIViewHttpService.GetAsyncaccepts environment instead of reading env var internallyRemoved
APIViewHttpService.GetEnvironment()static methodExample