-
Notifications
You must be signed in to change notification settings - Fork 1
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
introduce multi-path configuration #1
Conversation
problem: - sometimes you might have more than one healthcheck, eg. in Kubernetes we have readiness / liveliness checks solution: - extend the api to accept list of paths to ignore + tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this contribution, it's great stuff 😄 Have a look at my comments and let me know what you think. I'll quickly set up CI on this too, as I just noticed it's not yet running.
lib/plug/quiet_logger.ex
Outdated
@@ -8,9 +8,18 @@ defmodule Plug.QuietLogger do | |||
%{log: log, path: path} | |||
end | |||
|
|||
def call(%{request_path: path} = conn, %{log: :info, path: paths}) when is_list(paths) do | |||
cond do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I normally prefer an if
statement instead of a binary cond
, it feels a bit clearer!
if path in paths, do: conn, else: Plug.Logger.call(conn, log)
What do you think?
lib/plug/quiet_logger.ex
Outdated
@@ -8,9 +8,18 @@ defmodule Plug.QuietLogger do | |||
%{log: log, path: path} | |||
end | |||
|
|||
def call(%{request_path: path} = conn, %{log: :info, path: paths}) when is_list(paths) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded :info
would prevent the configurability of the log level. Is that intended?
lib/plug/quiet_logger.ex
Outdated
true -> Plug.Logger.call(conn, :info) | ||
end | ||
|
||
conn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this at the end of the function, you can safely rely on what's returned from the previous cond/if
statement 🙂
@amencarini thanks for the feedback, looks cleaner now! |
Amazing, thank you so much, will push to hex momentarily 🌈 |
Thank you!
…On Tue, Jul 24, 2018, 2:44 PM Alessandro Mencarini ***@***.***> wrote:
Amazing, thank you so much, will push to hex momentarily 🌈
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAE0Lo9RwW8UP13gXA2T2RefJyoOveXks5uJxaqgaJpZM4VROo0>
.
|
problem:
solution: