Skip to content

Commit

Permalink
Renamed Http to HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
appare45 committed Dec 26, 2024
1 parent 05dcf6b commit 4474546
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ func buildUA(ver, rev string) string {
}

// NewMackerelClient returns Mackerel API client for mackerel-agent
func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHttpKeepAlive bool) (*mackerel.API, error) {
api, err := mackerel.NewAPI(apibase, apikey, verbose, disableHttpKeepAlive)
func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHTTPKeepAlive bool) (*mackerel.API, error) {
api, err := mackerel.NewAPI(apibase, apikey, verbose, disableHTTPKeepAlive)
if err != nil {
return nil, err
}
Expand All @@ -708,7 +708,7 @@ func NewMackerelClient(apibase, apikey, ver, rev string, verbose bool, disableHt
// Prepare sets up API and registers the host data to the Mackerel server.
// Use returned values to call Run().
func Prepare(conf *config.Config, ameta *AgentMeta) (*App, error) {
api, err := NewMackerelClient(conf.Apibase, conf.Apikey, ameta.Version, ameta.Revision, conf.Verbose, conf.DisableHttpKeepAlive)
api, err := NewMackerelClient(conf.Apibase, conf.Apikey, ameta.Version, ameta.Revision, conf.Verbose, conf.DisableHTTPKeepAlive)
if err != nil {
return nil, fmt.Errorf("failed to prepare an api: %s", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func doRetire(fs *flag.FlagSet, argv []string) error {
return fmt.Errorf("hostID file is not found or empty")
}

api, err := command.NewMackerelClient(conf.Apibase, conf.Apikey, version, gitcommit, conf.Verbose, conf.DisableHttpKeepAlive)
api, err := command.NewMackerelClient(conf.Apibase, conf.Apikey, version, gitcommit, conf.Verbose, conf.DisableHTTPKeepAlive)
if err != nil {
return fmt.Errorf("faild to create api client: %s", err)
}
Expand Down
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type Config struct {
Verbose bool
Silent bool
Diagnostic bool `toml:"diagnostic"`
DisableHttpKeepAlive bool `toml:"disable_http_keep_alive"`
DisableHTTPKeepAlive bool `toml:"disable_http_keep_alive"`
DisplayName string `toml:"display_name"`
HostStatus HostStatus `toml:"host_status" conf:"parent"`
Disks Disks `toml:"disks" conf:"parent"`
Expand Down Expand Up @@ -448,8 +448,8 @@ func LoadConfig(conffile string) (*Config, error) {
if !config.Diagnostic {
config.Diagnostic = DefaultConfig.Diagnostic
}
if !config.DisableHttpKeepAlive {
config.DisableHttpKeepAlive = DefaultConfig.DisableHttpKeepAlive
if !config.DisableHTTPKeepAlive {
config.DisableHTTPKeepAlive = DefaultConfig.DisableHTTPKeepAlive
}

return config, err
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestLoadConfig(t *testing.T) {
t.Error("should be false (default value should be used)")
}

if config.DisableHttpKeepAlive != false {
if config.DisableHTTPKeepAlive != false {
t.Error("should be false (default value should be used)")
}
}
Expand Down
4 changes: 2 additions & 2 deletions mackerel/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func infoError(msg string) *InfoError {
}

// NewAPI creates a new instance of API.
func NewAPI(rawurl string, apiKey string, verbose bool, disableHttpKeepAlive bool) (*API, error) {
func NewAPI(rawurl string, apiKey string, verbose bool, disableHTTPKeepAlive bool) (*API, error) {
c, err := mkr.NewClientWithOptions(apiKey, rawurl, verbose)
if err != nil {
return nil, err
}
c.PrioritizedLogger = logger
t := http.DefaultTransport.(*http.Transport).Clone()
t.DisableKeepAlives = disableHttpKeepAlive
t.DisableKeepAlives = disableHTTPKeepAlive
c.HTTPClient.Transport = t

return &API{Client: c}, nil
Expand Down

0 comments on commit 4474546

Please sign in to comment.