-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: prevent duplicate configs, secrets, databases within module #1336
Conversation
dbs := make(map[string]int) | ||
|
||
for i, d := range decls { | ||
c, ok := d.(*Config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a type switch here instead of these separate individual type conversions:
switch d := d.(type) {
case *Config:
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops thank you!
configs[c.Name] = []int{i} | ||
continue | ||
} | ||
matchIdx, foundMatch := ftlslices.Find(configs[c.Name], func(j int) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this? Can't the maps just be map[string]*Config
, and if one already exists you report it as an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my, I somehow forgot pointers existed. Fixing this now whoops
fw fix in #1337 |
Fixes #1121
This adds backend schema validation preventing duplicate configs, secrets, and databases within a module. This also adds go-runtime validation preventing duplicate databases. Go-runtime validation for duplicate configs/secrets was added in PR #1328