mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
New release.
Includes the panic when cache is completely disabled.
This commit is contained in:
Vendored
+27
@@ -77,6 +77,9 @@ func EnableCache(cfg *CacheConfig) {
|
|||||||
|
|
||||||
func CacheLookup(hash string) []byte {
|
func CacheLookup(hash string) []byte {
|
||||||
if !IsCacheInitialized() {
|
if !IsCacheInitialized() {
|
||||||
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
|
Message: "Cache not initialized",
|
||||||
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +115,12 @@ func CacheLookup(hash string) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CacheDelete(hash string) {
|
func CacheDelete(hash string) {
|
||||||
|
if !IsCacheInitialized() {
|
||||||
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
|
Message: "Cache not initialized",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
config.Logger.Debug(&libpack_logger.LogMessage{
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
Message: "Deleting data from cache",
|
Message: "Deleting data from cache",
|
||||||
Pairs: map[string]interface{}{"hash": hash},
|
Pairs: map[string]interface{}{"hash": hash},
|
||||||
@@ -121,6 +130,12 @@ func CacheDelete(hash string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CacheStore(hash string, data []byte) {
|
func CacheStore(hash string, data []byte) {
|
||||||
|
if !IsCacheInitialized() {
|
||||||
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
|
Message: "Cache not initialized",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
config.Logger.Debug(&libpack_logger.LogMessage{
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
Message: "Storing data in cache",
|
Message: "Storing data in cache",
|
||||||
Pairs: map[string]interface{}{"hash": hash},
|
Pairs: map[string]interface{}{"hash": hash},
|
||||||
@@ -130,6 +145,12 @@ func CacheStore(hash string, data []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CacheStoreWithTTL(hash string, data []byte, ttl time.Duration) {
|
func CacheStoreWithTTL(hash string, data []byte, ttl time.Duration) {
|
||||||
|
if !IsCacheInitialized() {
|
||||||
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
|
Message: "Cache not initialized",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
config.Logger.Debug(&libpack_logger.LogMessage{
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
Message: "Storing data in cache with TTL",
|
Message: "Storing data in cache with TTL",
|
||||||
Pairs: map[string]interface{}{"hash": hash, "ttl": ttl},
|
Pairs: map[string]interface{}{"hash": hash, "ttl": ttl},
|
||||||
@@ -139,6 +160,12 @@ func CacheStoreWithTTL(hash string, data []byte, ttl time.Duration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CacheGetQueries() int64 {
|
func CacheGetQueries() int64 {
|
||||||
|
if !IsCacheInitialized() {
|
||||||
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
|
Message: "Cache not initialized",
|
||||||
|
})
|
||||||
|
return 0
|
||||||
|
}
|
||||||
config.Logger.Debug(&libpack_logger.LogMessage{
|
config.Logger.Debug(&libpack_logger.LogMessage{
|
||||||
Message: "Counting cache queries",
|
Message: "Counting cache queries",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ func parseConfig() {
|
|||||||
c.Cache.CacheRedisURL = getDetailsFromEnv("CACHE_REDIS_URL", "localhost:6379")
|
c.Cache.CacheRedisURL = getDetailsFromEnv("CACHE_REDIS_URL", "localhost:6379")
|
||||||
c.Cache.CacheRedisPassword = getDetailsFromEnv("CACHE_REDIS_PASSWORD", "")
|
c.Cache.CacheRedisPassword = getDetailsFromEnv("CACHE_REDIS_PASSWORD", "")
|
||||||
c.Cache.CacheRedisDB = getDetailsFromEnv("CACHE_REDIS_DB", 0)
|
c.Cache.CacheRedisDB = getDetailsFromEnv("CACHE_REDIS_DB", 0)
|
||||||
|
/* security */
|
||||||
c.Security.BlockIntrospection = getDetailsFromEnv("BLOCK_SCHEMA_INTROSPECTION", false)
|
c.Security.BlockIntrospection = getDetailsFromEnv("BLOCK_SCHEMA_INTROSPECTION", false)
|
||||||
c.Security.IntrospectionAllowed = func() []string {
|
c.Security.IntrospectionAllowed = func() []string {
|
||||||
urls := getDetailsFromEnv("ALLOWED_INTROSPECTION", "")
|
urls := getDetailsFromEnv("ALLOWED_INTROSPECTION", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user