feat: add include and exclude filtering options for database discovery
Build and Push / build (godump, amd64, linux) (push) Successful in 18s
Build and Push / build (godump, amd64, linux) (push) Successful in 18s
This commit is contained in:
@@ -39,6 +39,33 @@ func discoverDatabases(cfg config.InstanceConfig) ([]string, error) {
|
||||
if err := rows.Scan(&name); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(cfg.Include) > 0 {
|
||||
included := false
|
||||
for _, inc := range cfg.Include {
|
||||
if name == inc {
|
||||
included = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !included {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if len(cfg.Exclude) > 0 {
|
||||
excluded := false
|
||||
for _, exc := range cfg.Exclude {
|
||||
if name == exc {
|
||||
excluded = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if excluded {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
databases = append(databases, name)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user