-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
refactor(config): allow more configuration for upstreams
#1086
Conversation
Rename the `upstream` option to `upstreams.groups` so we can have more `upstreams` options.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1086 +/- ##
==========================================
- Coverage 93.80% 93.69% -0.11%
==========================================
Files 66 66
Lines 5341 5345 +4
==========================================
- Hits 5010 5008 -2
- Misses 258 263 +5
- Partials 73 74 +1
☔ View full report in Codecov by Sentry. |
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.
👍
Thanks for already working on the config part. What do you think of the idea with both "global" upstream and group specific settings? example for both global and group specific configuration: upstreams:
timeout: 5s
upstreamStrategy: parallel_best
otherSettingUsedByAllGroups: xyz
groups:
<name>:
timeout: 5s
upstreamStrategy: parallel_best
resolvers:
- 1.1.1.1
- 8.8.8.8 example for only group specific configuration: upstreams:
groups:
<name>:
timeout: 5s
upstreamStrategy: parallel_best
resolvers:
- 1.1.1.1
- 8.8.8.8 |
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.
Looks very good, thanks!
@@ -489,6 +490,8 @@ func unmarshalConfig(data []byte, cfg *Config) error { | |||
|
|||
func (cfg *Config) migrate(logger *logrus.Entry) bool { | |||
usesDepredOpts := Migrate(logger, "", cfg.Deprecated, map[string]Migrator{ | |||
"upstream": Move(To("upstreams.groups", &cfg.Upstreams)), |
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.
👍
10.43.8.67/28: | ||
- 1.1.1.1 | ||
- 9.9.9.9 | ||
upstreams: |
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.
👍
IMHO, one global configuration is enough. Configuration per group makes it too over-complicated and is useful only for very special edge cases. |
We can always add per group config later and be back compatible with a custom |
Rename the
upstream
option toupstreams.groups
so we can have moreupstreams
options.