diff --git a/enum/env.pb.go b/enum/env.pb.go index 0046088..8385177 100644 --- a/enum/env.pb.go +++ b/enum/env.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v3.19.4 +// protoc v4.22.4 // source: enum/env.proto package enum @@ -23,25 +23,25 @@ const ( type Env int32 const ( - Env_Local Env = 0 - Env_Develop Env = 1 - Env_Preview Env = 2 - Env_Production Env = 3 + Env_local Env = 0 + Env_develop Env = 1 + Env_preview Env = 2 + Env_production Env = 3 ) // Enum value maps for Env. var ( Env_name = map[int32]string{ - 0: "Local", - 1: "Develop", - 2: "Preview", - 3: "Production", + 0: "local", + 1: "develop", + 2: "preview", + 3: "production", } Env_value = map[string]int32{ - "Local": 0, - "Develop": 1, - "Preview": 2, - "Production": 3, + "local": 0, + "develop": 1, + "preview": 2, + "production": 3, } ) @@ -77,10 +77,10 @@ var File_enum_env_proto protoreflect.FileDescriptor var file_enum_env_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x65, 0x6e, 0x75, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x78, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x65, 0x6e, - 0x75, 0x6d, 0x2a, 0x3a, 0x0a, 0x03, 0x45, 0x6e, 0x76, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x6f, 0x63, - 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x10, - 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x10, 0x02, 0x12, 0x0e, - 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x03, 0x42, 0x30, + 0x75, 0x6d, 0x2a, 0x3a, 0x0a, 0x03, 0x45, 0x6e, 0x76, 0x12, 0x09, 0x0a, 0x05, 0x6c, 0x6f, 0x63, + 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x70, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x10, 0x02, 0x12, 0x0e, + 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x03, 0x42, 0x30, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x65, 0x61, 0x2e, 0x64, 0x72, 0x75, 0x67, 0x65, 0x79, 0x65, 0x73, 0x2e, 0x76, 0x69, 0x70, 0x2f, 0x70, 0x68, 0x61, 0x72, 0x6e, 0x65, 0x78, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x73, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x3b, 0x65, 0x6e, 0x75, 0x6d, diff --git a/glog/v1/logger.go b/glog/v1/logger.go index 1c8a94f..1e0b05d 100644 --- a/glog/v1/logger.go +++ b/glog/v1/logger.go @@ -35,9 +35,9 @@ func NewLogger(c *LoggerConfig) (log.Logger, func()) { switch c.Env { default: l = NewStdLogger(os.Stdout) - case enum.Env_Local.String(): + case enum.Env_local.String(): l = NewStdLogger(os.Stdout) - case enum.Env_Develop.String(), enum.Env_Preview.String(), enum.Env_Production.String(): + case enum.Env_develop.String(), enum.Env_preview.String(), enum.Env_production.String(): l = NewAliyunLog( WithAccessKey(c.AliLogConfig.AccessKey), WithAccessSecret(c.AliLogConfig.AccessSecret), diff --git a/interceptor/v1/grpc/interceptor.go b/interceptor/v1/grpc/interceptor.go index ab16fb3..6e2074e 100644 --- a/interceptor/v1/grpc/interceptor.go +++ b/interceptor/v1/grpc/interceptor.go @@ -42,7 +42,7 @@ func (i *Interceptor) UnaryServerInterceptor() grpc.UnaryServerInterceptor { return } - if i.env == enum.Env_Production { + if i.env == enum.Env_production { se := errors.FromError(err) if _, ok := i.reason[se.Reason]; ok { // 业务错误,原样返回 diff --git a/transport/v1/http/request.go b/transport/v1/http/request.go index 819f3fb..7d9ed54 100644 --- a/transport/v1/http/request.go +++ b/transport/v1/http/request.go @@ -125,7 +125,7 @@ func (t *Transport) RequestDecoderWithSignFilter(noEncrypt map[string]bool) http } // 正式服验签 - if t.env == enum.Env_Production && !noEncrypt[r.URL.Path] { + if t.env == enum.Env_production && !noEncrypt[r.URL.Path] { signature := request.NewSignature(t.apiKey, request.NewSHA1HashAlg()) signStr := signature.GenSignature(params) if signStr != r.Header.Get("sm5") { diff --git a/transport/v1/http/response.go b/transport/v1/http/response.go index ff6b7d9..cebcbda 100644 --- a/transport/v1/http/response.go +++ b/transport/v1/http/response.go @@ -104,7 +104,7 @@ func (t *Transport) ResponseEncoderWithEncrypt() http.EncodeResponseFunc { dataRes := string(data) // 正式服加密 - if t.env == enum.Env_Production { + if t.env == enum.Env_production { ecbMsg, err := sm4.Sm4Ecb([]byte(t.sm4Key), data, true) if err == nil { dataRes = fmt.Sprintf("\"%s\"", hex.EncodeToString(ecbMsg)) @@ -159,7 +159,7 @@ func (t *Transport) ResponseEncoderWithEncryptFilter(noEncrypt map[string]bool) dataRes := string(data) // 正式服加密 - if t.env == enum.Env_Production && !noEncrypt[r.URL.Path] { + if t.env == enum.Env_production && !noEncrypt[r.URL.Path] { ecbMsg, err := sm4.Sm4Ecb([]byte(t.sm4Key), data, true) if err == nil { dataRes = fmt.Sprintf("\"%s\"", hex.EncodeToString(ecbMsg)) @@ -183,7 +183,7 @@ func (t *Transport) ResponseEncoderWithEncryptFilter(noEncrypt map[string]bool) func (t *Transport) ErrorEncoder() http.EncodeErrorFunc { return func(w stdhttp.ResponseWriter, r *stdhttp.Request, err error) { se := errors.FromError(err) - if t.env == enum.Env_Production { + if t.env == enum.Env_production { if _, ok := err.(*errors.Error); !ok { se = ErrInternalServer }