Chromium Code Reviews| Index: milo/appengine/buildbucket/html.go |
| diff --git a/milo/appengine/buildbucket/html.go b/milo/appengine/buildbucket/html.go |
| index cf074c5b92ab1da1ff8df8ff53dfc391da8bf232..ca484e5e428835e44f6fc08e46994e445bb6c379 100644 |
| --- a/milo/appengine/buildbucket/html.go |
| +++ b/milo/appengine/buildbucket/html.go |
| @@ -5,22 +5,31 @@ |
| package buildbucket |
| import ( |
| + "context" |
| "errors" |
| "net/http" |
| "github.com/julienschmidt/httprouter" |
| + "github.com/luci/luci-go/common/logging" |
| "github.com/luci/luci-go/milo/appengine/common" |
| + "github.com/luci/luci-go/milo/common/config" |
| "github.com/luci/luci-go/server/router" |
| "github.com/luci/luci-go/server/templates" |
| ) |
| -// TODO(nodir): move this value to luci-config. |
| -const defaultServer = "cr-buildbucket.appspot.com" |
| +func parseBuilderQuery(c context.Context, r *http.Request, p httprouter.Params) ( |
| + query builderQuery, err error) { |
| -func parseBuilderQuery(r *http.Request, p httprouter.Params) (query builderQuery, err error) { |
| query.Server = r.FormValue("server") |
| if query.Server == "" { |
| - query.Server = defaultServer |
| + var settings *config.Settings |
| + settings, err = common.GetSettings(c) |
| + if err != nil || settings.Buildbucket == nil { |
| + logging.WithError(err).Errorf(c, "failed to get settings") |
|
nodir
2017/03/28 18:25:49
if err != nil, we didn't fail to get settings. Thi
hinoka
2017/03/28 19:21:02
We did tho
But anyways, this is split into two se
|
| + err = errors.New("no server specified and buildbucket settings not configured") |
| + return |
| + } |
| + query.Server = settings.Buildbucket.Host |
| } |
| query.Bucket = p.ByName("bucket") |
| @@ -45,7 +54,7 @@ func parseBuilderQuery(r *http.Request, p httprouter.Params) (query builderQuery |
| // Note: The builder html template contains self links to "?limit=123", which could |
| // potentially override any other request parameters set. |
| func BuilderHandler(c *router.Context) { |
| - query, err := parseBuilderQuery(c.Request, c.Params) |
| + query, err := parseBuilderQuery(c.Context, c.Request, c.Params) |
| if err != nil { |
| common.ErrorPage(c, http.StatusBadRequest, err.Error()) |
| return |