Skip to content

Commit e636b31

Browse files
committed
fix merge conflicts
1 parent c5f71ab commit e636b31

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

core/auth/auth.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,14 @@ func KeyAuth(cfg *config.Configuration) (http.RoundTripper, error) {
235235
}
236236

237237
// StackitCliAuth configures the [clients.STACKITCLIFlow] and returns an http.RoundTripper
238-
func StackitCliAuth(_ *config.Configuration) (http.RoundTripper, error) {
238+
func StackitCliAuth(cfg *config.Configuration) (http.RoundTripper, error) {
239+
cliCfg := clients.STACKITCLIFlowConfig{}
240+
if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil {
241+
cliCfg.HTTPTransport = cfg.HTTPClient.Transport
242+
}
243+
239244
client := &clients.STACKITCLIFlow{}
240-
if err := client.Init(&clients.STACKITCLIFlowConfig{}); err != nil {
245+
if err := client.Init(&cliCfg); err != nil {
241246
return nil, fmt.Errorf("error initializing client: %w", err)
242247
}
243248

core/clients/stackit_cli_flow.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"errors"
7+
"net/http"
78
"os"
89
"os/exec"
910
"runtime"
@@ -17,25 +18,25 @@ type STACKITCLIFlow struct {
1718
}
1819

1920
// STACKITCLIFlowConfig is the flow config
20-
type STACKITCLIFlowConfig struct{}
21+
type STACKITCLIFlowConfig struct {
22+
HTTPTransport http.RoundTripper
23+
}
2124

2225
// GetConfig returns the flow configuration
2326
func (c *STACKITCLIFlow) GetConfig() STACKITCLIFlowConfig {
2427
return STACKITCLIFlowConfig{}
2528
}
2629

27-
func (c *STACKITCLIFlow) Init(_ *STACKITCLIFlowConfig) error {
30+
func (c *STACKITCLIFlow) Init(cfg *STACKITCLIFlowConfig) error {
2831
token, err := c.getTokenFromCLI()
2932
if err != nil {
3033
return err
3134
}
3235

33-
c.config = &TokenFlowConfig{
36+
return c.TokenFlow.Init(&TokenFlowConfig{
3437
ServiceAccountToken: strings.TrimSpace(token),
35-
}
36-
37-
c.configureHTTPClient()
38-
return c.validate()
38+
HTTPTransport: cfg.HTTPTransport,
39+
})
3940
}
4041

4142
func (c *STACKITCLIFlow) getTokenFromCLI() (string, error) {

0 commit comments

Comments
 (0)