fix: code cleanup
Signed-off-by: jianfei.zhang <jianfei.zhang@daocloud.io>
This commit is contained in:
@ -236,7 +236,7 @@ func (t *tokenSimple) isValidSimpleToken(ctx context.Context, token string) bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-t.indexWaiter(uint64(index)):
|
case <-t.indexWaiter(index):
|
||||||
return true
|
return true
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ func TestNewAuthStoreBcryptCost(t *testing.T) {
|
|||||||
|
|
||||||
func encodePassword(s string) string {
|
func encodePassword(s string) string {
|
||||||
hashedPassword, _ := bcrypt.GenerateFromPassword([]byte(s), bcrypt.MinCost)
|
hashedPassword, _ := bcrypt.GenerateFromPassword([]byte(s), bcrypt.MinCost)
|
||||||
return base64.StdEncoding.EncodeToString([]byte(hashedPassword))
|
return base64.StdEncoding.EncodeToString(hashedPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testing.T)) {
|
func setupAuthStore(t *testing.T) (store *authStore, teardownfunc func(t *testing.T)) {
|
||||||
|
@ -48,6 +48,7 @@ import (
|
|||||||
"golang.org/x/net/http2"
|
"golang.org/x/net/http2"
|
||||||
"golang.org/x/net/trace"
|
"golang.org/x/net/trace"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
)
|
)
|
||||||
|
|
||||||
type serveCtx struct {
|
type serveCtx struct {
|
||||||
@ -137,7 +138,7 @@ func (sctx *serveCtx) serve(
|
|||||||
|
|
||||||
var gwmux *gw.ServeMux
|
var gwmux *gw.ServeMux
|
||||||
if s.Cfg.EnableGRPCGateway {
|
if s.Cfg.EnableGRPCGateway {
|
||||||
gwmux, err = sctx.registerGateway([]grpc.DialOption{grpc.WithInsecure()})
|
gwmux, err = sctx.registerGateway([]grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sctx.lg.Error("registerGateway failed", zap.Error(err))
|
sctx.lg.Error("registerGateway failed", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user