Skip to content

Commit 14922bb

Browse files
committed
Pass HTTP client to reservations production
So we get requests to SMD with the correct accces tokens.
1 parent 09d9de4 commit 14922bb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

internal/hsm/state_manager.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,16 @@ func (b *HSMv2) Init(globals *HSM_GLOBALS) error {
111111
logy.SetFormatter(Formatter)
112112

113113
b.HSMGlobals.Reservation = &reservation.Production{}
114-
b.HSMGlobals.Reservation.InitInstance(b.HSMGlobals.SMUrl, "", 1, logy, svcName)
114+
115+
116+
// Select the HTTP client to use
117+
httpClient := b.HSMGlobals.SVCHttpClient.InsecureClient
118+
if b.HSMGlobals.SVCHttpClient.SecureClient != nil {
119+
httpClient = b.HSMGlobals.SVCHttpClient.SecureClient
120+
}
121+
122+
// Initialize the reservation production instance with our http client, so bearer tokens are added to requests
123+
b.HSMGlobals.Reservation.InitWithHTTPClient(b.HSMGlobals.SMUrl, "", 1, logy, svcName, httpClient)
115124
}
116125

117126
//Make sure certain things are set up

0 commit comments

Comments
 (0)