Skip to content

Commit

Permalink
AnalyticsDisabled config value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr committed Feb 25, 2025
1 parent 1e35b29 commit 1904321
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion http/client_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func handleStatus(config *Config) func(w http.ResponseWriter, r *http.Request) {
BaseMessage: models.BaseMessage{
MessageType: models.MessageTypeInit,
},
AnalyticsEnabled: config.AnalyticsEnabled,
AnalyticsEnabled: !config.AnalyticsDisabled,
AuthRequired: config.UiPass != "",
ConfigStr: configStr,
ApiPrefix: config.HttpPathPrefix,
Expand Down
12 changes: 6 additions & 6 deletions http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ func StartWebserver(config *Config) {
}

type Config struct {
AnalyticsEnabled bool
UiPass string
ConfigFilePath string
BulkWindowMs int64
HttpPathPrefix string
ApiKey string
AnalyticsDisabled bool
UiPass string
ConfigFilePath string
BulkWindowMs int64
HttpPathPrefix string
ApiKey string

ServerPort string
ServerIp string
Expand Down
22 changes: 11 additions & 11 deletions logdy/logdy.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ func (l *LogdyInstance) LogString(message string) error {

func translateToConfig(c *Config) http.Config {
return http.Config{
AnalyticsEnabled: c.AnalyticsEnabled,
UiPass: c.UiPass,
ConfigFilePath: c.ConfigFilePath,
BulkWindowMs: c.BulkWindowMs,
HttpPathPrefix: c.HttpPathPrefix,
ServerPort: c.ServerPort,
ServerIp: c.ServerIp,
MaxMessageCount: c.MaxMessageCount,
LogLevel: c.LogLevel,
LogInterceptor: c.LogInterceptor,
ApiKey: c.ApiKey,
AnalyticsDisabled: c.AnalyticsEnabled,
UiPass: c.UiPass,
ConfigFilePath: c.ConfigFilePath,
BulkWindowMs: c.BulkWindowMs,
HttpPathPrefix: c.HttpPathPrefix,
ServerPort: c.ServerPort,
ServerIp: c.ServerIp,
MaxMessageCount: c.MaxMessageCount,
LogLevel: c.LogLevel,
LogInterceptor: c.LogInterceptor,
ApiKey: c.ApiKey,
}
}

Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func startWebServer(cmd *cobra.Command) {
go utils.CheckUpdatesAndPrintInfo(Version)
}

if !config.AnalyticsEnabled {
if !config.AnalyticsDisabled {
utils.Logger.Warn("No opt-out from analytics, we'll be receiving anonymous usage data, which will be used to improve the product. To opt-out use the flag --no-analytics.")
}

Expand All @@ -205,7 +205,7 @@ func parseConfig(cmd *cobra.Command) {
config.ApiKey, _ = cmd.Flags().GetString("api-key")
config.AppendToFileRaw, _ = cmd.Flags().GetBool("append-to-file-raw")
config.MaxMessageCount, _ = cmd.Flags().GetInt64("max-message-count")
config.AnalyticsEnabled, _ = cmd.Flags().GetBool("no-analytics")
config.AnalyticsDisabled, _ = cmd.Flags().GetBool("no-analytics")

modes.FallthroughGlobal, _ = cmd.Flags().GetBool("fallthrough")
modes.DisableANSICodeStripping, _ = cmd.Flags().GetBool("disable-ansi-code-stripping")
Expand Down

0 comments on commit 1904321

Please sign in to comment.