diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0ad2fe0..dee881a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,9 @@ on: workflow_dispatch: push: paths-ignore: - - '**.md' + - '**/**.md' + - '**/**.yaml' + - 'static/**' branches: - "*" diff --git a/README.md b/README.md index 9401ee6..ba64454 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,16 @@ I wanted to monitor the queries and responses of our graphql endpoint, but we di * `PORT_GRAPHQL` - the port to expose the graphql endpoint on (default: 8080) * `HOST_GRAPHQL` - the host to proxy the graphql endpoint to (default: `http://localhost/v1/graphql`) * `JWT_USER_CLAIM_PATH` - the path to the user claim in the JWT token (default: ``) -* `ENABLE_CACHE` - enable the cache (default: `false`) +* `ENABLE_GLOBAL_CACHE` - enable the cache (default: `false`) * `CACHE_TTL` - the cache TTL (default: `60s`) * `LOG_LEVEL` - the log level (default: `info`) * `BLOCK_SCHEMA_INTROSPECTION` - blocks the schema introspection (default: `false`) +### Caching + +Cache engine is enabled in background as it does not use any additional resources. +You can then start using the cache by setting the `ENABLE_GLOBAL_CACHE` environment variable to `true` - which will enable the cache for all queries, without introspection of the query. You can leave the global cache disabled and enable the cache for specific queries by adding the `@cache` directive to the query. + ### Monitoring endpoint Example metrics produced by the proxy: diff --git a/main.go b/main.go index adfa842..9c4b97b 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ func parseConfig() { c.Server.PortMonitoring = envutil.GetInt("MONITORING_PORT", 9393) c.Server.HostGraphQL = envutil.Getenv("HOST_GRAPHQL", "http://localhost/v1/graphql") c.Client.JWTUserClaimPath = envutil.Getenv("JWT_USER_CLAIM_PATH", "") - c.Cache.CacheEnable = envutil.GetBool("CACHE_ENABLE", false) + c.Cache.CacheEnable = envutil.GetBool("ENABLE_GLOBAL_CACHE", false) c.Cache.CacheTTL = envutil.GetInt("CACHE_TTL", 60) c.Security.BlockIntrospection = envutil.GetBool("BLOCK_SCHEMA_INTROSPECTION", false) c.Logger = libpack_logging.NewLogger() diff --git a/static/kubernetes-deployment.yaml b/static/kubernetes-deployment.yaml index 26e5d88..ceac15d 100644 --- a/static/kubernetes-deployment.yaml +++ b/static/kubernetes-deployment.yaml @@ -59,7 +59,7 @@ spec: value: "9393" - name: HOST_GRAPHQL value: http://hasura-internal:8080/v1/graphql - - name: ENABLE_CACHE + - name: ENABLE_GLOBAL_CACHE value: "true" - name: CACHE_TTL value: "10"