Skip to content

Conversation

@itschip
Copy link
Member

@itschip itschip commented Dec 23, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 23, 2025 21:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds conditional initialization of ClickHouse based on environment configuration, allowing the service to run without ClickHouse when not configured.

  • Introduces an Enabled flag to the ClickHouse client to track initialization state
  • Adds a helper function to determine whether ClickHouse should be initialized based on configuration
  • Fixes MIME type validation to use a fixed buffer size instead of full file size
  • Corrects a spelling error in an error message

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/clickhouse/client.go Adds Enabled field and conditional initialization logic to skip ClickHouse when disabled
cmd/lite/lite.go Implements conditional ClickHouse initialization based on host configuration
internal/http/middleware/mime.go Changes buffer allocation from file size to fixed 3072 bytes and fixes spelling error
internal/http/httputil/mime.go Updates buffer allocation to use fixed size instead of file header size
internal/service/file/file_service.go Adds comments clarifying API usage context for methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

c := &Client{}
func NewClient(config *Config, enabled bool) *Client {
if !enabled {
slog.Warn("clickhosue is disabled, logging is not available")
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'clickhosue' to 'clickhouse'.

Suggested change
slog.Warn("clickhosue is disabled, logging is not available")
slog.Warn("clickhouse is disabled, logging is not available")

Copilot uses AI. Check for mistakes.
cmd/lite/lite.go Outdated
Comment on lines 230 to 235
if clickhouseHost != "" {
return true
}
return false
}

Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

This function can be simplified to a single return statement: return clickhouseHost != \"\"

Suggested change
if clickhouseHost != "" {
return true
}
return false
}
return clickhouseHost != ""
}

Copilot uses AI. Check for mistakes.
cmd/lite/lite.go Outdated
clickhouse.AutoMigrate(cmd.Context(), chConfig)
}

clickhouseClient := clickhouse.NewClient(chConfig, shouldInitClickhouse(chConfig.Host))
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The shouldInitClickhouse function is called twice with the same argument (lines 83 and 88). Consider storing the result from line 83 in the clickhouseEnabled variable and reusing it here.

Suggested change
clickhouseClient := clickhouse.NewClient(chConfig, shouldInitClickhouse(chConfig.Host))
clickhouseClient := clickhouse.NewClient(chConfig, clickhouseEnabled)

Copilot uses AI. Check for mistakes.
@itschip itschip force-pushed the feat/enable-clickhouse branch from 30fa3e5 to f110099 Compare December 24, 2025 22:14
@itschip itschip merged commit da4535f into develop Dec 24, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant