mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
fix: add sslmode check and apend flag to conn string (#3009)
This commit is contained in:
parent
11893b2915
commit
b5e5078fc7
1 changed files with 4 additions and 1 deletions
|
@ -48,7 +48,7 @@ type AuthGCCfg struct {
|
|||
}
|
||||
|
||||
type FlushDBCfg struct {
|
||||
MaxItems *int `yaml:"max_items,omitempty"`
|
||||
MaxItems *int `yaml:"max_items,omitempty"`
|
||||
// We could unmarshal as time.Duration, but alert filters right now are a map of strings
|
||||
MaxAge *string `yaml:"max_age,omitempty"`
|
||||
BouncersGC *AuthGCCfg `yaml:"bouncers_autodelete,omitempty"`
|
||||
|
@ -131,6 +131,9 @@ func (d *DatabaseCfg) ConnectionString() string {
|
|||
} else {
|
||||
connString = fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?parseTime=True", d.User, d.Password, d.Host, d.Port, d.DbName)
|
||||
}
|
||||
if d.Sslmode != "" {
|
||||
connString = fmt.Sprintf("%s&tls=%s", connString, d.Sslmode)
|
||||
}
|
||||
case "postgres", "postgresql", "pgx":
|
||||
if d.isSocketConfig() {
|
||||
connString = fmt.Sprintf("host=%s user=%s dbname=%s password=%s", d.DbPath, d.User, d.DbName, d.Password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue