Giter Club home page Giter Club logo

Comments (9)

alexliesenfeld avatar alexliesenfeld commented on May 24, 2024

It was removed because authentication is not a primary concern of a health check library. The health check handler is just a standard http.Handler though, so you can use it with many middleware implementations, such as this or this .

from health.

panta avatar panta commented on May 24, 2024

Yes, but it's still useful to be able to return a more limited result to non-authenticated clients, instead of returning a 401 or 403. I can implement a middleware calling two different health handlers based on auth status, but in that case I'd have two separate but similar/identical copies of health checkers running in background, no?

from health.

alexliesenfeld avatar alexliesenfeld commented on May 24, 2024

Ah, I understand. Yes, this functionality was removed. As a replacement, I planned to add a more generic function to disable details on a request basis. This way you can decide in which situations you would like to disable details yourself. To do this, you would need to add a marker to the request context by calling a health.DisableResponseDetails(request.Context()) function whenever you want to return the reduced response. This could be called by your middleware. Would this be sufficient for you? This is just a rough sketch, I'm open for other ideas.

from health.

panta avatar panta commented on May 24, 2024

The marker/option would be nice. I was also thinking of separating and exposing the checks machinery from the handler(s), thus also allowing to further customize the output and the strategy of handling. I've seen this approach adopted in hellofresh/health-go for example. What would you think?

from health.

panta avatar panta commented on May 24, 2024

I've provided an implementation in panta/feature/standalone-checkers (just a matter of making the checker -> Checker interface public, add a NewChecker() function, and some other very minor adjustments).

If you feel this might be useful to others I'll send a PR.

from health.

alexliesenfeld avatar alexliesenfeld commented on May 24, 2024

Thanks. I looks interesting, indeed! Happy to get a PR for this. I'll look into it tonight.

from health.

alexliesenfeld avatar alexliesenfeld commented on May 24, 2024

Merged with #5

from health.

alexliesenfeld avatar alexliesenfeld commented on May 24, 2024

In case you're still interested in a solution: The new version 0.5.0 has a BasicAuth middleware that should do what you want.

from health.

panta avatar panta commented on May 24, 2024

Actually I need to use it with a different auth mechanism, but the stand-alone checkers are perfect for that!
Thanks!

from health.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.