Skip to content

Commit

Permalink
feat:init app support env app_access_key and app_secret
Browse files Browse the repository at this point in the history
  • Loading branch information
geebytes committed May 7, 2024
1 parent 5f6f001 commit f9f2613
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions internal/integration/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func RunTestServer() {
if begonia.Env != "" {
env = begonia.Env
}
log.Printf("env: %s", env)
config := config.ReadConfig(env)
go func() {

Expand Down
6 changes: 5 additions & 1 deletion internal/integration/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ func uploadParts(t *testing.T) {
c.So(rsp.Uri, c.ShouldNotBeEmpty)
c.So(rsp.Version, c.ShouldNotBeEmpty)
// c.So(rsp.Sha256,c.ShouldEqual,tmp.sha256)
conf := cfg.NewConfig(config.ReadConfig("dev"))
env:=begonia.Env
if env==""{
env="test"
}
conf := cfg.NewConfig(config.ReadConfig(env))

saveDir := filepath.Join(conf.GetUploadDir(), filepath.Dir(rsp.Uri))
filename := filepath.Base(rsp.Uri)
Expand Down
8 changes: 4 additions & 4 deletions transport/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ func (g *GrpcProxy) UnaryProxyInterceptor(ctx context.Context, req interface{},
endpoint, err := g.lb.Select(fullMethodName, clientIP)
// log.Println("选择连接完成")
if err != nil {
return nil, status.Errorf(codes.Unavailable, "no endpoint available,%v", err)
return nil, status.Errorf(codes.Unavailable, "no endpoint available to select,%v", err)
}
// log.Printf("grpc 选择连接:%v", endpoint.Addr())
cn, err := endpoint.Get(ctx)
if err != nil {
return nil, status.Errorf(codes.Unavailable, "no endpoint available,%v", err)
return nil, status.Errorf(codes.Unavailable, "no endpoint available from endpoint,%v", err)
}
// 释放链接
defer endpoint.AfterTransform(ctx, cn.((loadbalance.Connection)))
Expand Down Expand Up @@ -241,11 +241,11 @@ func (g *GrpcProxy) Handler(srv interface{}, serverStream grpc.ServerStream) err
// 传入ip地址(一致性哈希负载均衡算法)和方法名,选择一个端点
endpoint, err := g.lb.Select(fullMethodName, clientIP)
if err != nil {
return status.Errorf(codes.Unavailable, "no endpoint available")
return status.Errorf(codes.Unavailable, "no endpoint available to select,%v", err)
}
cn, err := endpoint.Get(serverStream.Context())
if err != nil {
return status.Errorf(codes.Unavailable, "no endpoint available")
return status.Errorf(codes.Unavailable, "no endpoint available from endpoint,%v", err)
}
// 释放链接
defer endpoint.AfterTransform(serverStream.Context(), cn.((loadbalance.Connection)))
Expand Down

0 comments on commit f9f2613

Please sign in to comment.