-
Notifications
You must be signed in to change notification settings - Fork 126
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
EVG-3358: use gimlet app for restv1 #1166
EVG-3358: use gimlet app for restv1 #1166
Conversation
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.
Also when I try to run evergreen locally now the waterfall 404s and I see a lot of "multiple response.WriteHeader calls" logged
service/service.go
Outdated
legacyApp.AddMiddleware(negroni.HandlerFunc(UserMiddleware(as.UserManager))) | ||
legacyApp.AddMiddleware(negroni.NewStatic(http.Dir(filepath.Join(uis.Home, "public")))) | ||
|
||
router, err := legacyApp.Router() |
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 app needs to be resolved before this I think
service/api_task_test.go
Outdated
@@ -77,7 +77,7 @@ func getEndTaskEndpoint(t *testing.T, as *APIServer, hostId, taskId string, deta | |||
|
|||
handler, err := as.Handler() | |||
if err != nil { | |||
t.Fatalf("creating test API handler: %v", err) | |||
t.Fatalf("cyreating test API handler: %v", err) |
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.
typo :)
|
||
func (ra *restV1middleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { | ||
vars := gimlet.GetVars(r) | ||
ctx, err := model.LoadContext(vars["task_id"], vars["build_id"], vars["version_id"], vars["patch_id"], vars["project_id"]) |
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.
project can also be stored in a cookie rather than the url (see the old getRequestProjectId func)
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.
as discussed in person, this is only true of the UI server, which has a very similar method.
return | ||
} | ||
|
||
if ctx.ProjectRef != nil && ctx.ProjectRef.Private && GetUser(r) == nil { |
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.
this feels like it belongs elsewhere, either in an auth method or in the route itself
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 think better to keep this out of the route itself, and also, I totally agree with you, but the problem is that this has to happen really late in the process (on the whole), so it might not get much better than this.
e4f176c
to
0ce4f5b
Compare
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.
lgtm once the smoke test passes
|
||
const RestContext restContextKey = 0 | ||
|
||
type restAPIService interface { |
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 feel like this interface shouldn't exist, but I also can't think of a cleaner way to do this :/
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 couldn't agree more. Some day we'll fix it.
f01ade3
to
11d45c4
Compare
No description provided.