From 7566e9141a0298ecafb1dd356aa2a7e399627527 Mon Sep 17 00:00:00 2001 From: Tolga Ozen Date: Sun, 7 Jul 2024 19:53:41 +0300 Subject: [PATCH] fix: cache missing fields added --- internal/engines/cache/cache.go | 6 ++++-- internal/engines/cache/cache_test.go | 10 +++++----- internal/invoke/invoke.go | 6 ++++-- pkg/cmd/serve.go | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal/engines/cache/cache.go b/internal/engines/cache/cache.go index 334c0e427..f8f8ad3f9 100644 --- a/internal/engines/cache/cache.go +++ b/internal/engines/cache/cache.go @@ -16,8 +16,10 @@ import ( base "github.com/Permify/permify/pkg/pb/base/v1" ) -var tracer = otel.Tracer("check-cache") -var meter = otel.Meter("check-cache") +var ( + tracer = otel.Tracer("check-cache") + meter = otel.Meter("check-cache") +) // CheckEngineWithCache is a struct that holds an instance of a cache.Cache for managing engine cache. type CheckEngineWithCache struct { diff --git a/internal/engines/cache/cache_test.go b/internal/engines/cache/cache_test.go index e8ffbd822..45cfdf18e 100644 --- a/internal/engines/cache/cache_test.go +++ b/internal/engines/cache/cache_test.go @@ -42,7 +42,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -92,7 +92,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -142,7 +142,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} // Create a new PermissionCheckRequest and PermissionCheckResponse checkReq := &base.PermissionCheckRequest{ @@ -286,7 +286,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} // Create a new PermissionCheckRequest checkReq := &base.PermissionCheckRequest{ @@ -321,7 +321,7 @@ var _ = Describe("cache", func() { Expect(err).ShouldNot(HaveOccurred()) // Initialize a new EngineKeys struct with a new cache.Cache instance - engineKeys := CheckEngineWithCache{nil, nil, cache, nil} + engineKeys := CheckEngineWithCache{nil, nil, cache, nil, nil} // Create some new PermissionCheckRequests and PermissionCheckResponses checkReq1 := &base.PermissionCheckRequest{ diff --git a/internal/invoke/invoke.go b/internal/invoke/invoke.go index 4816a6ed2..f2e01b89f 100644 --- a/internal/invoke/invoke.go +++ b/internal/invoke/invoke.go @@ -16,8 +16,10 @@ import ( "github.com/Permify/permify/pkg/tuple" ) -var tracer = otel.Tracer("invoke") -var meter = otel.Meter("invoke") +var ( + tracer = otel.Tracer("invoke") + meter = otel.Meter("invoke") +) // Invoker is an interface that groups multiple permission-related interfaces. // It is used to define a common contract for invoking various permission operations. diff --git a/pkg/cmd/serve.go b/pkg/cmd/serve.go index 4eee0d374..8b4b52a06 100644 --- a/pkg/cmd/serve.go +++ b/pkg/cmd/serve.go @@ -180,7 +180,7 @@ func serve() func(cmd *cobra.Command, args []string) error { panic(err) } - file, err := os.OpenFile(cfg.Log.File+"/app.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666) + file, err := os.OpenFile(cfg.Log.File+"/app.json", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600) if err != nil { panic(err) }