Skip to content

Commit

Permalink
chore: add toggle for backendconfig db caching (#3320)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvrach committed May 12, 2023
1 parent 860fda0 commit e75fea0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend-config/backend-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
configFromFile bool
maxRegulationsPerRequest int
configEnvReplacementEnabled bool
dbCacheEnabled bool

LastSync string
LastRegulationSync string
Expand Down Expand Up @@ -97,6 +98,7 @@ func loadConfig() {
config.RegisterBoolConfigVariable(false, &configFromFile, false, "BackendConfig.configFromFile")
config.RegisterIntConfigVariable(1000, &maxRegulationsPerRequest, true, 1, "BackendConfig.maxRegulationsPerRequest")
config.RegisterBoolConfigVariable(true, &configEnvReplacementEnabled, false, "BackendConfig.envReplacementEnabled")
config.RegisterBoolConfigVariable(true, &dbCacheEnabled, false, "BackendConfig.dbCacheEnabled")
}

func Init() {
Expand Down Expand Up @@ -319,6 +321,10 @@ func (bc *backendConfigImpl) StartWithIDs(ctx context.Context, workspaces string
bc.cancel = cancel
bc.blockChan = make(chan struct{})
bc.cache = cacheOverride

if !dbCacheEnabled {
bc.cache = &noCache{}
}
if bc.cache == nil {
identifier := bc.Identity()
u, _ := identifier.BasicAuth()
Expand Down

0 comments on commit e75fea0

Please sign in to comment.