Skip to content

Commit

Permalink
feat: check prefix instead of full key
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Sep 18, 2024
1 parent d16dfef commit 00d7a74
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,7 @@ type ForbiddenField struct {
var (
forbiddenFieldsOnConfig = []ForbiddenField{
{
FieldName: "aggregator.synchronizer.db.port",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.host",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.enablelog",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.password",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.user",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.name",
Reason: deprecatedFieldSyncDB,
},
{
FieldName: "aggregator.synchronizer.db.maxcoons",
FieldName: "aggregator.synchronizer.db.",
Reason: deprecatedFieldSyncDB,
},
}
Expand Down Expand Up @@ -237,7 +213,7 @@ func LoadFile(configFilePath string) (*Config, error) {

func getForbiddenField(fieldName string) *ForbiddenField {
for _, forbiddenField := range forbiddenFieldsOnConfig {
if forbiddenField.FieldName == fieldName {
if forbiddenField.FieldName == fieldName || strings.HasPrefix(fieldName, forbiddenField.FieldName) {
return &forbiddenField
}
}
Expand Down

0 comments on commit 00d7a74

Please sign in to comment.