Compare commits

..

1 Commits

Author SHA1 Message Date
tx7do
efbbf420c3 feat: fix error. 2023-11-02 20:25:11 +08:00
11 changed files with 28 additions and 23 deletions

View File

@@ -5,7 +5,7 @@ import (
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry" "github.com/go-kratos/kratos/v2/registry"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
// Bootstrap 应用引导启动 // Bootstrap 应用引导启动

View File

@@ -34,7 +34,7 @@ import (
k8sKratos "github.com/go-kratos/kratos/contrib/config/kubernetes/v2" k8sKratos "github.com/go-kratos/kratos/contrib/config/kubernetes/v2"
k8sUtil "k8s.io/client-go/util/homedir" k8sUtil "k8s.io/client-go/util/homedir"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
var commonConfig = &conf.Bootstrap{} var commonConfig = &conf.Bootstrap{}

View File

@@ -8,16 +8,19 @@ import (
"github.com/go-kratos/aegis/ratelimit" "github.com/go-kratos/aegis/ratelimit"
"github.com/go-kratos/aegis/ratelimit/bbr" "github.com/go-kratos/aegis/ratelimit/bbr"
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/registry"
"github.com/go-kratos/kratos/v2/middleware" "github.com/go-kratos/kratos/v2/middleware"
midRateLimit "github.com/go-kratos/kratos/v2/middleware/ratelimit" midRateLimit "github.com/go-kratos/kratos/v2/middleware/ratelimit"
"github.com/go-kratos/kratos/v2/middleware/recovery" "github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing" "github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/middleware/validate" "github.com/go-kratos/kratos/v2/middleware/validate"
"github.com/go-kratos/kratos/v2/registry"
kratosGrpc "github.com/go-kratos/kratos/v2/transport/grpc" kratosGrpc "github.com/go-kratos/kratos/v2/transport/grpc"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
const defaultTimeout = 5 * time.Second const defaultTimeout = 5 * time.Second

View File

@@ -17,7 +17,7 @@ import (
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/tracing" "github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
type LoggerType string type LoggerType string

2
oss.go
View File

@@ -6,7 +6,7 @@ import (
"github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
func NewMinIoClient(conf *conf.OSS) *minio.Client { func NewMinIoClient(conf *conf.OSS) *minio.Client {

View File

@@ -6,7 +6,7 @@ import (
"github.com/go-redis/redis/extra/redisotel/v8" "github.com/go-redis/redis/extra/redisotel/v8"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
// NewRedisClient 创建Redis客户端 // NewRedisClient 创建Redis客户端

View File

@@ -40,7 +40,7 @@ import (
servicecombClient "github.com/go-chassis/sc-client" servicecombClient "github.com/go-chassis/sc-client"
servicecombKratos "github.com/go-kratos/kratos/contrib/registry/servicecomb/v2" servicecombKratos "github.com/go-kratos/kratos/contrib/registry/servicecomb/v2"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
type RegistryType string type RegistryType string

View File

@@ -1,9 +1,11 @@
package bootstrap package bootstrap
import ( import (
"github.com/stretchr/testify/assert"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
"testing" "testing"
"github.com/stretchr/testify/assert"
conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
func TestNewConsulRegistry(t *testing.T) { func TestNewConsulRegistry(t *testing.T) {
@@ -56,16 +58,16 @@ func TestNewEurekaRegistry(t *testing.T) {
} }
func TestNewPolarisRegistry(t *testing.T) { func TestNewPolarisRegistry(t *testing.T) {
var cfg conf.Registry //var cfg conf.Registry
cfg.Polaris.Address = "127.0.0.1" //cfg.Polaris.Address = "127.0.0.1"
cfg.Polaris.Port = 8091 //cfg.Polaris.Port = 8091
cfg.Polaris.InstanceCount = 5 //cfg.Polaris.InstanceCount = 5
cfg.Polaris.Namespace = "default" //cfg.Polaris.Namespace = "default"
cfg.Polaris.Service = "DiscoverEchoServer" //cfg.Polaris.Service = "DiscoverEchoServer"
cfg.Polaris.Token = "" //cfg.Polaris.Token = ""
//
reg := NewPolarisRegistry(&cfg) //reg := NewPolarisRegistry(&cfg)
assert.Nil(t, reg) //assert.Nil(t, reg)
} }
func TestNewServicecombRegistry(t *testing.T) { func TestNewServicecombRegistry(t *testing.T) {

View File

@@ -12,7 +12,7 @@ import (
"github.com/gorilla/handlers" "github.com/gorilla/handlers"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
// CreateRestServer 创建REST服务端 // CreateRestServer 创建REST服务端

View File

@@ -1,3 +1,3 @@
git tag v0.2.13 git tag v0.2.14
git push origin --tags git push origin --tags

View File

@@ -16,7 +16,7 @@ import (
traceSdk "go.opentelemetry.io/otel/sdk/trace" traceSdk "go.opentelemetry.io/otel/sdk/trace"
semConv "go.opentelemetry.io/otel/semconv/v1.4.0" semConv "go.opentelemetry.io/otel/semconv/v1.4.0"
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1" conf "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
) )
// NewTracerExporter 创建一个导出器支持zipkin、otlp-http、otlp-grpc // NewTracerExporter 创建一个导出器支持zipkin、otlp-http、otlp-grpc