diff --git a/internal/engines/subjectFilter.go b/internal/engines/subjectFilter.go index fee81f653..16ebef2cb 100644 --- a/internal/engines/subjectFilter.go +++ b/internal/engines/subjectFilter.go @@ -517,10 +517,10 @@ func (engine *SubjectFilter) subjectFilterDirectRelation( // setChild generates a SubjectFilterFunction by applying a SubjectFilterCombiner // to a set of child permission lookups, given a request and a list of Child objects. func (engine *SubjectFilter) setChild( - ctx context.Context, // The context for carrying out the operation + ctx context.Context, // The context for carrying out the operation request *base.PermissionLookupSubjectRequest, // The request containing parameters for lookup - children []*base.Child, // The children of a particular node in the permission schema - combiner SubjectFilterCombiner, // A function to combine the results from multiple lookup functions + children []*base.Child, // The children of a particular node in the permission schema + combiner SubjectFilterCombiner, // A function to combine the results from multiple lookup functions ) SubjectFilterFunction { var functions []SubjectFilterFunction // Array of functions to store lookup functions for each child diff --git a/pkg/cmd/log.go b/pkg/cmd/log.go index d0c30045d..0b7e1f67c 100644 --- a/pkg/cmd/log.go +++ b/pkg/cmd/log.go @@ -7,14 +7,15 @@ import ( "log/slog" "os" - "github.com/Permify/permify/pkg/telemetry" - "github.com/Permify/permify/pkg/telemetry/logexporters" "github.com/Permify/sloggcp" "github.com/agoda-com/opentelemetry-go/otelslog" + + "github.com/Permify/permify/pkg/telemetry" + "github.com/Permify/permify/pkg/telemetry/logexporters" ) // HandlerFactory - Create log handler according to given params -func HandlerFactory(name string, endpoint string, insecure bool, urlpath string, headers map[string]string, protocol string, level slog.Leveler) (slog.Handler, error) { +func HandlerFactory(name, endpoint string, insecure bool, urlpath string, headers map[string]string, protocol string, level slog.Leveler) (slog.Handler, error) { switch name { case "otlp", "otlp-http", "otlp-grpc": return NewOTLPHandler(endpoint, insecure, urlpath, headers, protocol, level.Level()) @@ -53,7 +54,9 @@ func NewGCPHandler(headers map[string]string, level slog.Leveler) (slog.Handler, // Set credentials for Google Cloud access if creds != "" { - os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", creds) + if err := os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", creds); err != nil { + return nil, err + } } // Initialize GCP-specific log handler diff --git a/pkg/telemetry/meterexporters/gcp.go b/pkg/telemetry/meterexporters/gcp.go index 3dade1128..0afe28364 100644 --- a/pkg/telemetry/meterexporters/gcp.go +++ b/pkg/telemetry/meterexporters/gcp.go @@ -9,9 +9,10 @@ import ( // NewGCP creates a new Google Cloud metric exporter with optional headers for credentials and project ID. func NewGCP(headers map[string]string) (metric.Exporter, error) { - if credentials, exists := headers["google-application-credentials"]; exists && credentials != "" { - os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", credentials) + if err := os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", credentials); err != nil { + return nil, err + } } if projectID, exists := headers["google-cloud-project"]; exists && projectID != "" { diff --git a/pkg/telemetry/tracerexporters/gcp.go b/pkg/telemetry/tracerexporters/gcp.go index b34397b53..ec4e54803 100644 --- a/pkg/telemetry/tracerexporters/gcp.go +++ b/pkg/telemetry/tracerexporters/gcp.go @@ -9,9 +9,10 @@ import ( // NewGCP creates a new Google Cloud tracer with optional headers for credentials and project ID. func NewGCP(headers map[string]string) (sdktrace.SpanExporter, error) { - if credentials, exists := headers["google-application-credentials"]; exists && credentials != "" { - os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", credentials) + if err := os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", credentials); err != nil { + return nil, err + } } if projectID, exists := headers["google-cloud-project"]; exists && projectID != "" {