Browse Source

set caching to true by defaulT

abhishek9686 1 year ago
parent
commit
fff2239f02
2 changed files with 6 additions and 6 deletions
  1. 1 1
      config/config.go
  2. 5 5
      servercfg/serverconf.go

+ 1 - 1
config/config.go

@@ -91,7 +91,7 @@ type ServerConfig struct {
 	Environment                string        `yaml:"environment"`
 	JwtValidityDuration        time.Duration `yaml:"jwt_validity_duration"`
 	RacAutoDisable             bool          `yaml:"rac_auto_disable"`
-	CacheEnabled               bool          `yaml:"caching_enabled"`
+	CacheEnabled               string        `yaml:"caching_enabled"`
 }
 
 // SQLConfig - Generic SQL Config

+ 5 - 5
servercfg/serverconf.go

@@ -173,11 +173,11 @@ func GetDB() string {
 
 // CacheEnabled - checks if cache is enabled
 func CacheEnabled() bool {
-	caching := false
-	if os.Getenv("CACHING_ENABLED") != "" {
-		caching = os.Getenv("CACHING_ENABLED") == "true"
-	} else if config.Config.Server.Database != "" {
-		caching = config.Config.Server.CacheEnabled
+	caching := true
+	if os.Getenv("CACHING_ENABLED") == "false" {
+		caching = false
+	} else if config.Config.Server.CacheEnabled == "false" {
+		caching = false
 	}
 	return caching
 }