Skip to content

add: robots middleware#627

Merged
tj merged 1 commit into
apex:masterfrom
markelog:robots
Mar 30, 2018
Merged

add: robots middleware#627
tj merged 1 commit into
apex:masterfrom
markelog:robots

Conversation

@markelog
Copy link
Copy Markdown
Contributor

Closes #610

Haven't add a way to turn it off. Should I? If so, in what format?

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 27, 2018

CLA assistant check
All committers have signed the CLA.

Comment thread http/robots/robots.go Outdated
// New robots middleware.
func New(c *up.Config, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if os.Getenv("UP_STAGE") != "production" {
Copy link
Copy Markdown
Member

@tj tj Mar 28, 2018

Choose a reason for hiding this comment

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

Works for me! Only thing I'd tweak for now is:

if os.Getenv("UP_STAGE") == "production" {
  return next
}

return otherMiddlewareHere

Or we could delegate that decision to the handler.go so it's just never added for prod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's much better. Incapsulated it in the middleware for now

@tj tj merged commit 527bac4 into apex:master Mar 30, 2018
@tj
Copy link
Copy Markdown
Member

tj commented Mar 30, 2018

thanks man!

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.

3 participants