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

How to use Context from middleware #2406

Open
Ker515 opened this issue Sep 23, 2020 · 1 comment
Open

How to use Context from middleware #2406

Ker515 opened this issue Sep 23, 2020 · 1 comment
Labels
question runtime Relates to github.com/go-openapi/runtime

Comments

@Ker515
Copy link

Ker515 commented Sep 23, 2020

Problem statement

I generated the source code with go-swagger, so I would like the middleware to inject zap logger in the context that I can later re-use in the handlers. Anyway to do this?

Swagger specification

Steps to reproduce

Environment

swagger version: x.x.x
go version: x.x.x
OS:

@fredbi fredbi added runtime Relates to github.com/go-openapi/runtime question labels Nov 14, 2020
@fredbi
Copy link
Contributor

fredbi commented Nov 14, 2020

@Ker515 You can setup middleware from the configure_api_xxx.go initialization step (or any equivalent initializer you may have done). Here is how: https://goswagger.io/use/middleware.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question runtime Relates to github.com/go-openapi/runtime
Projects
None yet
Development

No branches or pull requests

2 participants