Skip to content

ability to disable http and/or event consumer for user log service - #3285

Open
maki5 wants to merge 1 commit into
mainfrom
feat/userlog_event_handler_on_demand
Open

ability to disable http and/or event consumer for user log service#3285
maki5 wants to merge 1 commit into
mainfrom
feat/userlog_event_handler_on_demand

Conversation

@maki5

@maki5 maki5 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

for user log service it's possible now to disable/enable from config

  • events listener(consumer)
  • http server

@codacy-production

codacy-production Bot commented Aug 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 57 duplication

Metric Results
Duplication 57

View in Codacy

🟢 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

View coverage diff in Codacy

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.

Comment on lines +33 to +35
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%"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread pkg/shared/errors.go
service, defaults.BaseConfigPath())
}

func AllComponentsDisabledError(service string) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Suggested change
func AllComponentsDisabledError(service string) error {
func AllApiHandlersDisabledError(service string) error {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants