Skip to content

Commit

Permalink
feat(fxgcppubsub): Added Avro and Protobuf schemas support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekkinox committed Jun 11, 2024
1 parent d7ed86d commit f9bc3bc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fxgcppubsub/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/ankorstore/yokai/config"
"go.uber.org/fx"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
Expand Down Expand Up @@ -113,7 +114,18 @@ func NewFxGcpPubSubSchemaClient(p FxGcpPubSubSchemaClientParam) (*pubsub.SchemaC
return client, nil

Check warning on line 114 in fxgcppubsub/module.go

View check run for this annotation

Codecov / codecov/patch

fxgcppubsub/module.go#L114

Added line #L114 was not covered by tests
}

client, err := pubsub.NewSchemaClient(p.Context, p.Config.GetString("modules.gcppubsub.project.id"))
var schemaClientOptions []option.ClientOption
if emulatorHost := p.Config.GetEnvVar("PUBSUB_EMULATOR_HOST"); emulatorHost != "" {
schemaClientOptions = []option.ClientOption{
option.WithEndpoint(emulatorHost),
option.WithoutAuthentication(),
option.WithTelemetryDisabled(),
internaloption.SkipDialSettingsValidation(),
option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())),
}
}

Check warning on line 126 in fxgcppubsub/module.go

View check run for this annotation

Codecov / codecov/patch

fxgcppubsub/module.go#L117-L126

Added lines #L117 - L126 were not covered by tests

client, err := pubsub.NewSchemaClient(p.Context, p.Config.GetString("modules.gcppubsub.project.id"), schemaClientOptions...)

Check warning on line 128 in fxgcppubsub/module.go

View check run for this annotation

Codecov / codecov/patch

fxgcppubsub/module.go#L128

Added line #L128 was not covered by tests
if err != nil {
return nil, fmt.Errorf("failed to create pubsub schema client: %w", err)

Check warning on line 130 in fxgcppubsub/module.go

View check run for this annotation

Codecov / codecov/patch

fxgcppubsub/module.go#L130

Added line #L130 was not covered by tests
}
Expand Down

0 comments on commit f9bc3bc

Please sign in to comment.