Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/fluent-bit-output-plugin/output_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func (c *pluginConfig) toStringMap() map[string]string {
// Define all possible configuration keys based on the structs and documentation
configKeys := []string{
// Client config
"Url", "TenantID", "BatchWait", "BatchSize", "Labels", "Timeout", "MinBackoff", "MaxBackoff", "MaxRetries",
"Url", "ProxyUrl", "TenantID", "BatchWait", "BatchSize", "Labels", "Timeout", "MinBackoff", "MaxBackoff",
"MaxRetries",
"SortByTimestamp", "NumberOfBatchIDs", "IdLabelName",

// Plugin config
Expand Down Expand Up @@ -377,6 +378,7 @@ func main() {}
func dumpConfiguration(_logger log.Logger, conf *config.Config) {
paramLogger := log.With(_logger, "[flb-go]", "provided parameter")
_ = level.Debug(paramLogger).Log("URL", conf.ClientConfig.CredativValiConfig.URL)
_ = level.Debug(paramLogger).Log("ProxyURL", conf.ClientConfig.CredativValiConfig.Client.ProxyURL.URL)
_ = level.Debug(paramLogger).Log("TenantID", conf.ClientConfig.CredativValiConfig.TenantID)
_ = level.Debug(paramLogger).Log("BatchWait", conf.ClientConfig.CredativValiConfig.BatchWait)
_ = level.Debug(paramLogger).Log("BatchSize", conf.ClientConfig.CredativValiConfig.BatchSize)
Expand Down
21 changes: 21 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package config
import (
"encoding/json"
"fmt"
stdurl "net/url"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -323,6 +324,7 @@ func processControllerConfigBoolFields(configMap map[string]any, config *Config)
func postProcessConfig(config *Config, configMap map[string]any) error {
processors := []func(*Config, map[string]any) error{
processURLConfig,
processProxyURLConfig,
processClientConfig,
processDurationConfigs,
processLabelsConfig,
Expand Down Expand Up @@ -366,6 +368,25 @@ func processURLConfig(config *Config, configMap map[string]any) error {
return nil
}

func processProxyURLConfig(config *Config, configMap map[string]any) error {
var proxyURLString string
if url, ok := configMap["ProxyURL"].(string); ok && url != "" {
proxyURLString = url
} else if url, ok = configMap["ProxyUrl"].(string); ok && url != "" {
proxyURLString = url
}

if proxyURLString != "" {
url, err := stdurl.Parse(proxyURLString)
if err != nil {
return fmt.Errorf("failed to parse proxy URL: %w", err)
}
config.ClientConfig.CredativValiConfig.Client.ProxyURL.URL = url
}

return nil
}

// processClientConfig handles client configuration field copying
func processClientConfig(config *Config, _ map[string]any) error {
// Copy simple fields from ClientConfig to CredativValiConfig (after mapstructure processing)
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ var _ = Describe("Config", func() {
// Logging configuration
"LogLevel": "info",
"Url": "http://logging.garden.svc:3100/vali/api/v1/push",
"ProxyUrl": "http://proxy.local:8080",

// Batch configuration
"BatchWait": "60s",
Expand Down Expand Up @@ -403,6 +404,8 @@ var _ = Describe("Config", func() {
Expect(cfg.LogLevel.String()).To(Equal("info"))
// "Url": "http://logging.garden.svc:3100/vali/api/v1/push"
Expect(cfg.ClientConfig.CredativValiConfig.URL.String()).To(Equal("http://logging.garden.svc:3100/vali/api/v1/push"))
// "ProxyUrl": "http://proxy.local:8080"
Expect(cfg.ClientConfig.CredativValiConfig.Client.ProxyURL.URL.String()).To(Equal("http://proxy.local:8080"))

// Batch configuration
// "BatchWait": "60s"
Expand Down
Loading