Skip to content

Commit

Permalink
[exporter/bmchelix] New component: BMC Helix Exporter
Browse files Browse the repository at this point in the history
* Fixed ApiKey var naming (APIKey)
  • Loading branch information
NassimBtk committed Jan 10, 2025
1 parent 0869621 commit 0aadc01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions exporter/bmchelixexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// Config struct is used to store the configuration of the exporter
type Config struct {
Endpoint string `mapstructure:"endpoint"`
ApiKey string `mapstructure:"api_key"`
APIKey string `mapstructure:"api_key"`
Timeout time.Duration `mapstructure:"timeout"`
RetryConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
}
Expand All @@ -23,7 +23,7 @@ func (c *Config) Validate() error {
if c.Endpoint == "" {
return errors.New("endpoint is required")
}
if c.ApiKey == "" {
if c.APIKey == "" {
return errors.New("api key is required")
}
if c.Timeout <= 0 {
Expand Down
12 changes: 6 additions & 6 deletions exporter/bmchelixexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "helix1"),
expected: &Config{
Endpoint: "https://helix1:8080",
ApiKey: "api_key",
APIKey: "api_key",
Timeout: 10 * time.Second,
RetryConfig: configretry.NewDefaultBackOffConfig(),
},
Expand All @@ -41,7 +41,7 @@ func TestLoadConfig(t *testing.T) {
id: component.NewIDWithName(metadata.Type, "helix2"),
expected: &Config{
Endpoint: "https://helix2:8080",
ApiKey: "api_key",
APIKey: "api_key",
Timeout: 20 * time.Second,
RetryConfig: configretry.BackOffConfig{
Enabled: true,
Expand Down Expand Up @@ -80,14 +80,14 @@ func TestValidateConfig(t *testing.T) {
name: "valid_config",
config: &Config{
Endpoint: "https://helix:8080",
ApiKey: "api_key",
APIKey: "api_key",
Timeout: 10 * time.Second,
},
},
{
name: "invalid_config1",
config: &Config{
ApiKey: "api_key",
APIKey: "api_key",
},
err: "endpoint is required",
},
Expand All @@ -102,7 +102,7 @@ func TestValidateConfig(t *testing.T) {
name: "invalid_config3",
config: &Config{
Endpoint: "https://helix:8080",
ApiKey: "api_key",
APIKey: "api_key",
Timeout: -1,
},
err: "timeout must be a positive integer",
Expand All @@ -111,7 +111,7 @@ func TestValidateConfig(t *testing.T) {
name: "invalid_config4",
config: &Config{
Endpoint: "https://helix:8080",
ApiKey: "api_key",
APIKey: "api_key",
Timeout: 0,
},
err: "timeout must be a positive integer",
Expand Down

0 comments on commit 0aadc01

Please sign in to comment.