Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.30.0 #1378

Merged
merged 24 commits into from
Jan 10, 2025
Merged

Release/v1.30.0 #1378

merged 24 commits into from
Jan 10, 2025

Conversation

Umang01-hash
Copy link
Contributor

@Umang01-hash Umang01-hash commented Jan 8, 2025

Release v1.30.0

🚀 Features

1. GoFr's Context Support in gRPC Handlers

Introduced context integration for gRPC handlers, enabling efficient dependency and tracing management.

  • Key Features:

    • Automatically generates gRPC handler templates with built-in support for gofr's context using the gofr wrap grpc command.

    • Customizable gRPC server implementation provided in the generated {ServiceName}_server.go file.

    • Auto-generated file {ServiceName}_gofr.go handles context logic (Do not modify this file).

    • Example: This file, hello_server.go demonstrates the generated template implementing gRPC methods for the Hello service with embedded gofr.Context.

      // Assuming proto file was defined in package hello
      package hello
      
      import "gofr.dev/pkg/gofr"
      
      // Register the gRPC service in main.go:
      // hello.RegisterHelloServerWithGofr(app, &hello.HelloGoFrServer{})
      
      type HelloGoFrServer struct{}
      
      func (s *HelloGoFrServer) SayHello(ctx *gofr.Context) (any, error) {
        // Accessing the incoming request using gofr.Context:
        // var request HelloRequest
        // if err := ctx.Bind(&request); err != nil {
        // return nil, err
        // }
        
        response := &HelloResponse{
          Message: fmt.Sprintf("Hello, %s!", user.Name),
        }
      
        return response, nil
      }
  • Prerequisites:

    1. Install GoFr CLI:

      go install gofr.dev/cli/gofr@latest
    2. Generate gRPC Handlers:

      Run gofr wrap grpc -proto=<path_to_proto_file> after generating .pb.go and _grpc.pb.go files using protoc.

  • Register gRPC Service:

    Integrate the generated server into your GoFr app:

    app := gofr.New()
    
    packageName.Register{serviceName}ServerWithGofr(app, &packageName.{serviceName}GoFrServer{})
    
    app.Run()
  • Note: For details on setting up Protocol Buffers and gRPC in GoFr, visit the official GoFr.dev Documentation.

🔧 Fixes

1. ExpectSelect Update in SQL Mocks

Refactored the ExpectSelect function in SQL mocks. Users can now set expected responses using the ReturnsResponse method, ensuring accurate mock behavior during tests.

  • Example Usage:

    var result, actualResult Response
    
    mockContainer, sqlMock := NewMockContainer(t)
    ctx := &gofr.Context{
      Container: mockContainer,
    }
    
    expectedResult := Response{
      // ... fill with expected values
    }
    
    sqlMock.ExpectSelect(ctx, &result, query).ReturnsResponse(expectedResult)
    
    ctx.SQL.Select(ctx, &actualResult, query)
    
    assert.Equal(t, actualResult, expectedResult)

2. Environment Variable Handling

  • OS-level environment variables now override values from .env, .<APP_ENV>.env configurations, ensuring consistent behaviour across environments.

3. Improved Logging

  • Removed sensitive information (e.g., usernames and passwords) from MongoDB connection logs by replacing uri with host.
  • Fixed inaccurate Redis connection logs and removed unnecessary SQL connection logs when no SQL connection is established.
  • Added error logs for database migration failures, improving visibility during debugging.

4. Security Fixes

  • Updated golang.org/x/crypto to v0.31.0 to resolve potential authorization bypass issues.
  • Updated go.mod in pkg/gofr/datasource/mongo for compatibility with Go commands.

Umang01-hash and others added 20 commits December 26, 2024 14:38
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.0 to 1.69.2.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.69.0...v1.69.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
…olang.org/grpc-1.69.2

Bump google.golang.org/grpc from 1.69.0 to 1.69.2
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.27.0 to 0.28.0.
- [Commits](golang/term@v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…rg/x/term-0.28.0

Bump golang.org/x/term from 0.27.0 to 0.28.0
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.24.0 to 0.25.0.
- [Commits](golang/oauth2@v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
…rg/x/oauth2-0.25.0

Bump golang.org/x/oauth2 from 0.24.0 to 0.25.0
@Umang01-hash Umang01-hash changed the base branch from development to main January 8, 2025 11:23
pkg/gofr/datasource/mongo/mongo.go Dismissed Show dismissed Hide dismissed
pkg/gofr/datasource/mongo/mongo.go Dismissed Show dismissed Hide dismissed
pkg/gofr/datasource/mongo/mongo.go Dismissed Show dismissed Hide dismissed
@aryanmehrotra aryanmehrotra merged commit a197221 into main Jan 10, 2025
13 checks passed
@aryanmehrotra aryanmehrotra deleted the release/v1.30.0 branch January 10, 2025 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants