@@ -8,7 +8,6 @@ like the baseURL, authentication details, and an embedded standard HTTP client.
88package httpclient
99
1010import (
11- "log"
1211 "net/http"
1312 "sync"
1413 "time"
@@ -83,23 +82,11 @@ type PerformanceMetrics struct {
8382}
8483
8584// BuildClient creates a new HTTP client with the provided configuration.
86- func BuildClient (configFilePath string ) (* Client , error ) {
87-
88- // Load the configuration
89- config , err := SetClientConfiguration (configFilePath )
90- if err != nil {
91- log .Printf ("Failed to set client configuration: %v" , err ) // This uses the standard log package before zap logger is initialized
92- return nil , err
93- }
85+ func BuildClient (config ClientConfig ) (* Client , error ) {
9486
9587 // Parse the log level string to logger.LogLevel
9688 parsedLogLevel := logger .ParseLogLevelFromString (config .ClientOptions .LogLevel )
9789
98- // Set default value if none is provided
99- if config .ClientOptions .LogConsoleSeparator == "" {
100- config .ClientOptions .LogConsoleSeparator = ","
101- }
102-
10390 // Initialize the logger with parsed config values
10491 log := logger .BuildLogger (parsedLogLevel , config .ClientOptions .LogOutputFormat , config .ClientOptions .LogConsoleSeparator )
10592
@@ -128,7 +115,7 @@ func BuildClient(configFilePath string) (*Client, error) {
128115 AuthMethod : authMethod ,
129116 OverrideBaseDomain : config .Environment .OverrideBaseDomain ,
130117 httpClient : & http.Client {Timeout : config .ClientOptions .CustomTimeout },
131- clientConfig : * config ,
118+ clientConfig : config ,
132119 Logger : log ,
133120 ConcurrencyMgr : NewConcurrencyManager (config .ClientOptions .MaxConcurrentRequests , log , true ),
134121 PerfMetrics : PerformanceMetrics {},
0 commit comments