Skip to content

Commit

Permalink
Merge branch 'main' into qryn-gigapipe-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
akvlad committed Oct 17, 2024
2 parents 8e4079d + 98901a4 commit 3339409
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
15 changes: 8 additions & 7 deletions common/config/qryn.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import (
const (
qrynHost = "QRYN_URL"
qrynAPIKey = "QRYN_API_KEY"
qrynAPISecret = "QRYN_API_SECRET"
qrynAddExporterName = "QRYN_ADD_EXPORTER_NAME"
resourceToTelemetryConversion = "QRYN_RESOURCE_TO_TELEMETRY_CONVERSION"
qrynSecretsOptional = "__QRYN_SECRETS_OPTIONAL__"
qrynPasswordFieldName = "__QRYN_PASSWORD_FIELD_NAME__"
)

type qrynConf struct {
host string
key string
secret string
addExporterName bool
resourceToTelemetryConversion bool
secretsOptional bool
passwordFieldName string
}

type Qryn struct{}
Expand All @@ -39,7 +39,11 @@ func (g *Qryn) ModifyConfig(dest ExporterConfigurer, currentConfig *Config) erro
return err
}

baseURL, err := parseURL(dest.GetConfig()[qrynHost], conf.key, conf.secret)
passwordPlaceholder := "${QRYN_API_SECRET}"
if conf.passwordFieldName != "" {
passwordPlaceholder = "${" + conf.passwordFieldName + "}"
}
baseURL, err := parseURL(dest.GetConfig()[qrynHost], conf.key, passwordPlaceholder)
if err != nil {
return errors.New("API host is not a valid")
}
Expand Down Expand Up @@ -120,10 +124,10 @@ func (g *Qryn) getConfigs(dest ExporterConfigurer) qrynConf {
return qrynConf{
host: dest.GetConfig()[qrynHost],
key: dest.GetConfig()[qrynAPIKey],
secret: dest.GetConfig()[qrynAPISecret],
addExporterName: dest.GetConfig()[qrynAddExporterName] == "Yes",
resourceToTelemetryConversion: dest.GetConfig()[resourceToTelemetryConversion] == "Yes",
secretsOptional: dest.GetConfig()[qrynSecretsOptional] == "1",
passwordFieldName: dest.GetConfig()[qrynPasswordFieldName],
}
}

Expand All @@ -134,9 +138,6 @@ func (g *Qryn) checkConfigs(conf *qrynConf) error {
if !conf.secretsOptional && conf.key == "" {
return errors.New("missing API key")
}
if !conf.secretsOptional && conf.secret == "" {
return errors.New("missing API secret")
}
return nil
}

Expand Down
3 changes: 1 addition & 2 deletions common/config/qryn_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
const (
qrynOssHost = "QRYN_OSS_URL"
qrynOssUsername = "QRYN_OSS_USERNAME"
qrynOssPassword = "QRYN_OSS_PASSWORD"
qrynOssresourceToTelemetryConversion = "QRYN_OSS_RESOURCE_TO_TELEMETRY_CONVERSION"
qrynOssAddExporterName = "QRYN_OSS_ADD_EXPORTER_NAME"
)
Expand All @@ -24,10 +23,10 @@ func (d QrynOssDest) GetConfig() map[string]string {
conf := d.ExporterConfigurer.GetConfig()
conf[qrynHost] = conf[qrynOssHost]
conf[qrynAPIKey] = conf[qrynOssUsername]
conf[qrynAPISecret] = conf[qrynOssPassword]
conf[resourceToTelemetryConversion] = conf[qrynOssresourceToTelemetryConversion]
conf[qrynSecretsOptional] = "1"
conf[qrynAddExporterName] = conf[qrynOssAddExporterName]
conf[qrynPasswordFieldName] = "QRYN_OSS_PASSWORD"
return conf
}

Expand Down
1 change: 1 addition & 0 deletions destinations/data/qryn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
componentProps:
type: password
required: true
secret: true
- name: QRYN_API_KEY
displayName: API Key
componentType: input
Expand Down
1 change: 1 addition & 0 deletions destinations/data/qrynoss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
componentType: input
componentProps:
type: password
secret: true
- name: QRYN_OSS_USERNAME
displayName: Basic auth username
componentType: input
Expand Down

0 comments on commit 3339409

Please sign in to comment.