Skip to content

Commit 6669e42

Browse files
author
gwind
committed
do not check access for addauth middleware
1 parent ba58323 commit 6669e42

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

middlewares/addauth/addauth.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"net/http"
66

7-
"github.com/Sirupsen/logrus"
87
"github.com/codegangsta/negroni"
98
"github.com/ooclab/ga/service"
109
)
@@ -26,10 +25,11 @@ func (h *addauthMiddleware) ServeHTTP(w http.ResponseWriter, req *http.Request,
2625
func NewMiddleware(cfg map[string]interface{}) (negroni.Handler, error) {
2726

2827
app := service.NewApp()
29-
if err := app.CheckAccess(); err != nil {
30-
logrus.Errorf("app access failed: %s\n", err)
31-
return nil, err
32-
}
28+
// 启动过程中不要测试可访问性,应为此时该服务很可能还没启动。容易形成循环依赖。
29+
// if err := app.CheckAccess(); err != nil {
30+
// logrus.Errorf("app access failed: %s\n", err)
31+
// return nil, err
32+
// }
3333

3434
return &addauthMiddleware{
3535
app: app,

service/request.go

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func (client *Client) SendRequest(
9191
serviceResp := &Response{HTTPResponse: resp}
9292
if err := json.Unmarshal(respBody, &serviceResp.Body); err != nil {
9393
logrus.Errorf("unmarshal body json failed: %s\n", err)
94+
logrus.Debugf("respBody: %s\n", string(respBody[:]))
9495
return nil, err
9596
}
9697

0 commit comments

Comments
 (0)