From 5afe2ec3cdd1abcc4988fce550ae4d52b7bb25cf Mon Sep 17 00:00:00 2001 From: Pavel <177363085+pkcll@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:14:46 -0400 Subject: [PATCH] Beholder: rename cert config option --- pkg/beholder/client.go | 7 +++---- pkg/beholder/config.go | 4 ++-- pkg/beholder/config_test.go | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/beholder/client.go b/pkg/beholder/client.go index c0e564f80..203bea8d7 100644 --- a/pkg/beholder/client.go +++ b/pkg/beholder/client.go @@ -93,10 +93,9 @@ func newOtelClient(cfg Config, errorHandler errorHandlerFunc, otlploggrpcNew otl if err != nil { return nil, err } - var creds credentials.TransportCredentials - creds = insecure.NewCredentials() - if !cfg.InsecureConnection && cfg.TLSCertFile != "" { - creds, err = credentials.NewClientTLSFromFile(cfg.TLSCertFile, "") + creds := insecure.NewCredentials() + if !cfg.InsecureConnection && cfg.CACertFile != "" { + creds, err = credentials.NewClientTLSFromFile(cfg.CACertFile, "") if err != nil { return nil, err } diff --git a/pkg/beholder/config.go b/pkg/beholder/config.go index 4d602d81a..a7f7dd0b9 100644 --- a/pkg/beholder/config.go +++ b/pkg/beholder/config.go @@ -8,7 +8,7 @@ import ( type Config struct { InsecureConnection bool - TLSCertFile string + CACertFile string OtelExporterGRPCEndpoint string PackageName string @@ -32,7 +32,7 @@ var defaultOtelAttributes = map[string]string{ func DefaultConfig() Config { return Config{ InsecureConnection: true, - TLSCertFile: "", + CACertFile: "", OtelExporterGRPCEndpoint: "localhost:4317", PackageName: "beholder", // Resource diff --git a/pkg/beholder/config_test.go b/pkg/beholder/config_test.go index 40349e88e..523376f60 100644 --- a/pkg/beholder/config_test.go +++ b/pkg/beholder/config_test.go @@ -14,7 +14,7 @@ const ( func ExampleConfig() { config := beholder.Config{ InsecureConnection: true, - TLSCertFile: "", + CACertFile: "", OtelExporterGRPCEndpoint: "localhost:4317", PackageName: packageName, // Resource @@ -34,5 +34,5 @@ func ExampleConfig() { } fmt.Printf("%+v", config) // Output: - // {InsecureConnection:true TLSCertFile: OtelExporterGRPCEndpoint:localhost:4317 PackageName:beholder ResourceAttributes:map[package_name:beholder sender:beholdeclient] EmitterExportTimeout:1s TraceSampleRate:1 TraceBatchTimeout:1s MetricReaderInterval:1s LogExportTimeout:1s} + // {InsecureConnection:true CACertFile: OtelExporterGRPCEndpoint:localhost:4317 PackageName:beholder ResourceAttributes:map[package_name:beholder sender:beholdeclient] EmitterExportTimeout:1s TraceSampleRate:1 TraceBatchTimeout:1s MetricReaderInterval:1s LogExportTimeout:1s} }