Skip to content

Commit 5268491

Browse files
committed
Pass HTTP client to reservations production
So we get requests to SMD with the correct accces tokens. Signed-off-by: Chris Harris <cjh@lbl.gov>
1 parent 316e1ec commit 5268491

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
@@ -112,7 +112,16 @@ func (b *HSMv2) Init(globals *HSM_GLOBALS) error {
112112
logy.SetFormatter(Formatter)
113113

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

118127
//Make sure certain things are set up

0 commit comments

Comments
 (0)