-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature/string push #23
Conversation
return nil | ||
case "text/plain": | ||
var text = string(b[:]) | ||
if len(text) < 10 { |
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.
probably, its better to check if the received string is an actual valid image reference.
internal/server/webhooks.go
Outdated
@@ -31,9 +29,11 @@ func RequireHeaders(headers []kobold.Header, handler http.Handler) http.Handler | |||
func NewPushWebhook(id string, subs []chan events.PushData, ph events.PayloadHandler) http.Handler { | |||
logger := log.With().Str("endpoint", id).Logger() | |||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |||
logger.Info().Str("endpoint", id).Msg("push event received") | |||
var ct string = r.Header.Get("Content-Type") | |||
logger.Info().Str("endpoint", id).Msg(fmt.Sprintf("push event received with Content-Type: %s", ct)) |
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.
zerolog is based on structured data. So it would be more idiomatic to add another Str
call before the message
Something like below:
logger.Info().Str("endpoint", id).Str("contentType", ct).Msg("push event received")
@@ -13,6 +13,7 @@ require ( | |||
github.com/google/go-licenses v1.6.0 | |||
github.com/hashicorp/go-retryablehttp v0.7.4 | |||
github.com/mitchellh/mapstructure v1.5.0 | |||
github.com/novln/docker-parser v1.0.0 |
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.
Do you think this is really required? I would assume there is a way around it. That library is quite old and not alot used. I think its possible to get the tag from the google other library.
3fdab58
to
d9d064f
Compare
Closing as its already implemented by #25 |
resolve: #18
as discussed ability too push strings