Skip to content

Commit 68f0f36

Browse files
henrybarretogustavosbarreto
authored andcommitted
feat(pkg): add base url configuration on internal http client
1 parent 160e6c3 commit 68f0f36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/api/internalclient/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type Config struct {
2828
RetryWaitTime time.Duration
2929
// RetryMaxWaitTime defines the maximum wait time between retries.
3030
RetryMaxWaitTime time.Duration
31+
32+
// BaseURL defines the base URL for the API.
33+
BaseURL string
3134
}
3235

3336
type client struct {
@@ -59,6 +62,7 @@ func NewClient(opts ...clientOption) (Client, error) {
5962
RetryCount: 3,
6063
RetryWaitTime: 5 * time.Second,
6164
RetryMaxWaitTime: 20 * time.Second,
65+
BaseURL: "http://api:8080",
6266
},
6367
}
6468

@@ -72,7 +76,7 @@ func NewClient(opts ...clientOption) (Client, error) {
7276
httpClient.SetLogger(&LeveledLogger{c.logger})
7377
}
7478

75-
httpClient.SetBaseURL("http://api:8080")
79+
httpClient.SetBaseURL(c.Config.BaseURL)
7680
httpClient.SetRetryCount(c.Config.RetryCount)
7781
httpClient.SetRetryWaitTime(c.Config.RetryWaitTime)
7882
httpClient.SetRetryMaxWaitTime(c.Config.RetryMaxWaitTime)

0 commit comments

Comments
 (0)