Conversation
|
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.



Bug Fix: Swagger Host Not Updated with Dynamic Address and Port
When the server starts with a custom port (via CLI flag
-porPC_PORT_NUMenvironment variable), the Swagger documentation should reflect the actual server address and port instead of showing the hardcoded defaultlocalhost:8080.Problem
Currently, the interactive Swagger UI at
/swagger/index.htmlalways showslocalhost:8080as the host, even when the server is running on a different port or address configured through:process-compose -p 9090PC_PORT_NUM=9090 process-composeThis causes the Swagger UI to fail to communicate with the API when using non-standard ports.
Solution
Update the
SwaggerInfo.Hostdynamically in theStartHttpServerWithTCP()function before the router is created. TheSwaggerInfovariable is already exported and designed to be modified at runtime (as indicated by its comment: "holds exported Swagger Info so clients can modify it").Changes Required
Modify
src/api/server.go:docspackagedocs.SwaggerInfo.Hostwith the actual address and port inStartHttpServerWithTCP()functionImplementation Details
"github.com/f1bonacc1/process-compose/src/docs"StartHttpServerWithTCP(), add at the beginning (beforerouter := getRouter(...)):