Skip to content

Commit

Permalink
feat: fixed missing cache params (#1340)
Browse files Browse the repository at this point in the history
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones authored Dec 4, 2024
1 parent c3f4486 commit 1363219
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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
)
Expand Down
5 changes: 5 additions & 0 deletions pkg/cache/interplex_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"errors"
"google.golang.org/grpc"
"os"
)

var _ ICache = (*InterplexCache)(nil)
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 1363219

Please sign in to comment.