Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed reference to localhost from swagger #336

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

michaelkebe
Copy link
Contributor

@michaelkebe michaelkebe commented Jan 13, 2024

Now it is possible to use the swagger webinterface running on a host other than localhost e.g. in docker or kubernetes.

Removed the @host line from pkg/api/server.go and
ran make swagger.

Fixes: #179

@Dogacel
Copy link

Dogacel commented Mar 14, 2024

Yes please, I have a remote kubernetes cluster so I can't use swagger UI due to this bug.

@stefanprodan
Copy link
Owner

@michaelkebe can you please rebase and fix the conflicts. Thanks

@michaelkebe
Copy link
Contributor Author

Will do in 2 weeks.

@michaelkebe
Copy link
Contributor Author

Looks like c305843 has broken some swagger stuff.

XXX@XXX~/podinfo (remove-localhost=) $ make swagger
go install github.com/swaggo/swag/cmd/swag@latest
go get github.com/swaggo/swag/gen@latest
go get github.com/swaggo/swag/cmd/swag@latest
cd pkg/api && $(go env GOPATH)/bin/swag init -g server.go
2024/04/09 08:03:58 Generate swagger docs....
2024/04/09 08:03:58 Generate general API Info, search dir:./
2024/04/09 08:03:58 warning: failed to get package name in dir: ./, error: execute go list command, exit status 1, stdout:, stderr:no Go files in /home/XXX/podinfo/pkg/api
2024/04/09 08:03:58 cannot parse source files /home/XXX/podinfo/pkg/api/server.go: open /home/XXX/podinfo/pkg/api/server.go: no such file or directory
make: *** [Makefile:96: swagger] Error 1

Trying to replace some references to api.... to http..... E.g.

find . -exec sed -i 's/api.MapResponse/http.MapResponse/g' {} \;

But there are still some references to localhost because "Try" in swagger ui does not work yet. Working on it.

Now it is possible to use the swagger webinterface
running on a host other than localhost e.g. in docker
or kubernetes.

Removed the @host line from pkg/api/server.go and
ran make swagger.

Fixes probably stefanprodan#179
@michaelkebe
Copy link
Contributor Author

Fixed it.

@michaelkebe
Copy link
Contributor Author

@stefanprodan There were no other references to localhost had to compile everything with make build-container after make swagger. Works now.

Fixed the swagger target in Makefile.

Copy link
Owner

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @michaelkebe 🏅

@stefanprodan stefanprodan merged commit d879d0f into stefanprodan:master Apr 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Be able to set swagger "Base URL" via helm chart
3 participants