diff --git a/go.mod b/go.mod index df9e9ce641..0f33e2ab36 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,6 @@ require ( github.com/pterm/pterm v0.12.80 google.golang.org/api v0.209.0 gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.1 sigs.k8s.io/controller-runtime v0.19.2 sigs.k8s.io/gateway-api v1.2.1 ) @@ -190,6 +189,7 @@ require ( google.golang.org/grpc/stats/opentelemetry v0.0.0-20240907200651-3ffb98b2c93a // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect knative.dev/pkg v0.0.0-20241026180704-25f6002b00f3 // indirect mvdan.cc/sh/v3 v3.8.0 // indirect ) diff --git a/pkg/cache/interplex_based.go b/pkg/cache/interplex_based.go index 8cfc99a2f5..e6fb110981 100644 --- a/pkg/cache/interplex_based.go +++ b/pkg/cache/interplex_based.go @@ -6,6 +6,7 @@ import ( "context" "errors" "google.golang.org/grpc" + "os" ) var _ ICache = (*InterplexCache)(nil) @@ -35,6 +36,10 @@ func (c *InterplexCache) Configure(cacheInfo CacheProvider) error { func (c *InterplexCache) Store(key string, data string) error { + if os.Getenv("INTERPLEX_LOCAL_MODE") != "" { + c.configuration.ConnectionString = "localhost:8084" + } + conn, err := grpc.NewClient(c.configuration.ConnectionString, grpc.WithInsecure(), grpc.WithBlock()) defer conn.Close() if err != nil { diff --git a/pkg/server/config/config.go b/pkg/server/config/config.go index d6af8dac25..c728f63f55 100644 --- a/pkg/server/config/config.go +++ b/pkg/server/config/config.go @@ -71,7 +71,8 @@ func (h *Handler) AddConfig(ctx context.Context, i *schemav1.AddConfigRequest) ( remoteCache, err = cache.NewCacheProvider("s3", i.Cache.GetS3Cache().BucketName, i.Cache.GetS3Cache().Region, i.Cache.GetS3Cache().Endpoint, notUsedStorageAcc, notUsedContainerName, notUsedProjectId, i.Cache.GetS3Cache().Insecure) case *schemav1.Cache_GcsCache: remoteCache, err = cache.NewCacheProvider("gcs", i.Cache.GetGcsCache().BucketName, i.Cache.GetGcsCache().Region, notUsedEndpoint, notUsedStorageAcc, notUsedContainerName, i.Cache.GetGcsCache().GetProjectId(), notUsedInsecure) - + case *schemav1.Cache_InterplexCache: + remoteCache, err = cache.NewCacheProvider("interplex", notUsedBucket, notUsedRegion, i.Cache.GetInterplexCache().Endpoint, notUsedStorageAcc, notUsedContainerName, notUsedProjectId, notUsedInsecure) default: return resp, status.Error(codes.InvalidArgument, "Invalid cache configuration") }