Chore (sqlstore): add validation and testing for repl config (#90683)

* add some validation and testing for repl cf
* connection strings are secrets
This commit is contained in:
Kristin Laemmert
2024-07-29 10:32:56 -04:00
committed by GitHub
parent d12cd4280c
commit af19f039b6
4 changed files with 121 additions and 15 deletions
+5
View File
@@ -2,6 +2,7 @@ package sqlstore
import (
"errors"
"fmt"
"regexp"
"sync/atomic"
"time"
@@ -84,6 +85,10 @@ func ProvideServiceWithReadReplica(primary *SQLStore, cfg *setting.Cfg,
return nil, err
}
if err := validateReplicaConfigs(primary.dbCfg, replCfgs); err != nil {
return nil, fmt.Errorf("failed to validate replica configurations: %w", err)
}
if len(replCfgs) > 0 {
replStore.repls = make([]*SQLStore, len(replCfgs))
}