ability to disable http and/or event consumer for user log service - #3285
ability to disable http and/or event consumer for user log service#3285maki5 wants to merge 1 commit into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 57 |
🟢 Coverage 9.43% diff coverage · -0.01% coverage variation
Metric Results Coverage variation ✅ -0.01% coverage variation (-1.00%) Diff coverage ✅ 9.43% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (f03429f) 84010 19269 22.94% Head commit (4258594) 84049 (+39) 19269 (+0) 22.93% (-0.01%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#3285) 53 5 9.43% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
| EventsDisabled bool `yaml:"events_disabled" env:"USERLOG_EVENTS_DISABLED" desc:"Disables listening for events. Set this to true if the service should only handle HTTP requests." introductionVersion:"%NEXT%"` | ||
| HTTPDisabled bool `yaml:"http_disabled" env:"USERLOG_HTTP_DISABLED" desc:"Disables the HTTP service. Set this to true if the service should only handle events." introductionVersion:"%NEXT%"` | ||
|
|
There was a problem hiding this comment.
There are dedicated structs for HTTP and Events, move the flags there.
| } else { | ||
| logger.Info().Msg("HTTP server disabled, not starting HTTP service") | ||
|
|
||
| if !cfg.EventsDisabled { |
There was a problem hiding this comment.
the logic here seems wrong. If !cfg.HTTPDisabled is true the else branch is not reached ... meaning the Events service cannot be enabled when the HTTPServer is enabled. Or am I misunderstanding the logic?
| service, defaults.BaseConfigPath()) | ||
| } | ||
|
|
||
| func AllComponentsDisabledError(service string) error { |
There was a problem hiding this comment.
I'd suggest naming that about "API handlers" instead of "components", since "components" is a super generic term that can mean anything, that will allow for a more specific error message as well (the error text below mentions "request handlers and event consumers", that's a lot more specific than "components")
| func AllComponentsDisabledError(service string) error { | |
| func AllApiHandlersDisabledError(service string) error { |
for user log service it's possible now to disable/enable from config