Skip to content

Commit

Permalink
fix: minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tankerkiller125 committed Oct 10, 2024
1 parent 17af865 commit b792899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions backend/app/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/pkgerrors"
_ "github.com/shirou/gopsutil/v4/host"
"github.com/sysadminsmedia/homebox/backend/internal/core/currencies"
"github.com/sysadminsmedia/homebox/backend/internal/core/services"
"github.com/sysadminsmedia/homebox/backend/internal/core/services/reporting/eventbus"
Expand Down Expand Up @@ -101,17 +100,18 @@ func run(cfg *config.Config) error {
}
bodyReader := bytes.NewReader(jsonBody)
req, err := http.NewRequest("POST", "https://a.sysadmins.zone/api/event", bodyReader)
if err != nil {
log.Error().Err(err).Msg("failed to create analytics request")
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 OPR/71.0.3770.284")
req.Header.Set("User-Agent", "Homebox/"+version+"/"+build()+" (https://homebox.software)")
client := &http.Client{
Timeout: 10 * time.Second,
}
res, err := client.Do(req)
_, err = client.Do(req)

Check failure on line 111 in backend/app/api/main.go

View workflow job for this annotation

GitHub Actions / Backend Server Tests / Go

response body must be closed (bodyclose)
if err != nil {
return err
log.Error().Err(err).Msg("failed to send analytics request")
}
log.Info().Msgf("Analytics Response: %v", res)
log.Info().Msgf("Analytics Response: %v", json.NewEncoder(os.Stdout).Encode(analytics))
}

// =========================================================================
Expand Down
2 changes: 1 addition & 1 deletion backend/internal/sys/config/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Options struct {
AllowRegistration bool `yaml:"disable_registration" conf:"default:true"`
AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"`
CurrencyConfig string `yaml:"currencies"`
AllowAnalytics bool `yaml:"allow_analytics" conf:"default:true"`
AllowAnalytics bool `yaml:"allow_analytics" conf:"default:false"`
}

type DebugConf struct {
Expand Down

0 comments on commit b792899

Please sign in to comment.