@@ -8,7 +8,6 @@ like the baseURL, authentication details, and an embedded standard HTTP client.
8
8
package httpclient
9
9
10
10
import (
11
- "log"
12
11
"net/http"
13
12
"sync"
14
13
"time"
@@ -83,23 +82,11 @@ type PerformanceMetrics struct {
83
82
}
84
83
85
84
// 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 ) {
94
86
95
87
// Parse the log level string to logger.LogLevel
96
88
parsedLogLevel := logger .ParseLogLevelFromString (config .ClientOptions .LogLevel )
97
89
98
- // Set default value if none is provided
99
- if config .ClientOptions .LogConsoleSeparator == "" {
100
- config .ClientOptions .LogConsoleSeparator = ","
101
- }
102
-
103
90
// Initialize the logger with parsed config values
104
91
log := logger .BuildLogger (parsedLogLevel , config .ClientOptions .LogOutputFormat , config .ClientOptions .LogConsoleSeparator )
105
92
@@ -128,7 +115,7 @@ func BuildClient(configFilePath string) (*Client, error) {
128
115
AuthMethod : authMethod ,
129
116
OverrideBaseDomain : config .Environment .OverrideBaseDomain ,
130
117
httpClient : & http.Client {Timeout : config .ClientOptions .CustomTimeout },
131
- clientConfig : * config ,
118
+ clientConfig : config ,
132
119
Logger : log ,
133
120
ConcurrencyMgr : NewConcurrencyManager (config .ClientOptions .MaxConcurrentRequests , log , true ),
134
121
PerfMetrics : PerformanceMetrics {},
0 commit comments