Skip to content

Commit

Permalink
fixup! feat(config): Add fields for controller rate limit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tmessi committed Oct 11, 2023
1 parent 79042e3 commit 4aa4d74
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions internal/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ type Controller struct {
SchedulerRunJobInterval time.Duration `hcl:"-"`

ApiRateLimits ratelimit.Configs `hcl:"-"`
ApiRateLimiterMaxEntires int `hcl:"api_rate_limit_max_entries"`
ApiRateLimiterMaxEntries int `hcl:"api_rate_limit_max_entries"`

// License is the license used by HCP builds
License string `hcl:"license"`
Expand Down Expand Up @@ -692,8 +692,8 @@ func Parse(d string) (*Config, error) {
return nil, err
}

if result.Controller.ApiRateLimiterMaxEntires <= 0 {
result.Controller.ApiRateLimiterMaxEntires = ratelimit.DefaultLimiterMaxEntries
if result.Controller.ApiRateLimiterMaxEntries <= 0 {
result.Controller.ApiRateLimiterMaxEntries = ratelimit.DefaultLimiterMaxEntries
}
}

Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/config/config_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func TestLoad(t *testing.T) {
WorkerStatusGracePeriodDuration: 0,
LivenessTimeToStaleDuration: 0,
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: false,
DevUiPassthroughDir: "",
Expand Down Expand Up @@ -844,7 +844,7 @@ func TestLoad(t *testing.T) {
WorkerStatusGracePeriodDuration: 0,
LivenessTimeToStaleDuration: 0,
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: false,
DevUiPassthroughDir: "",
Expand Down Expand Up @@ -1283,7 +1283,7 @@ func TestLoad(t *testing.T) {
Unlimited: false,
},
},
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: false,
DevUiPassthroughDir: "",
Expand Down Expand Up @@ -1703,7 +1703,7 @@ func TestLoad(t *testing.T) {
WorkerStatusGracePeriodDuration: 0,
LivenessTimeToStaleDuration: 0,
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: false,
DevUiPassthroughDir: "",
Expand Down Expand Up @@ -1794,7 +1794,7 @@ func TestLoad(t *testing.T) {
WorkerStatusGracePeriodDuration: 0,
LivenessTimeToStaleDuration: 0,
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: false,
DevUiPassthroughDir: "",
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestDevController(t *testing.T) {
Name: "dev-controller",
Description: "A default controller created in dev mode",
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: true,
}
Expand Down Expand Up @@ -487,7 +487,7 @@ func TestDevCombined(t *testing.T) {
Name: "dev-controller",
Description: "A default controller created in dev mode",
ApiRateLimits: make(ratelimit.Configs, 0),
ApiRateLimiterMaxEntires: ratelimit.DefaultLimiterMaxEntries,
ApiRateLimiterMaxEntries: ratelimit.DefaultLimiterMaxEntries,
},
DevController: true,
Worker: &Worker{
Expand Down

0 comments on commit 4aa4d74

Please sign in to comment.