Skip to content

Commit

Permalink
fix: use host token for management if it's provided
Browse files Browse the repository at this point in the history
Fixes #499
  • Loading branch information
connor4312 committed Aug 22, 2022
1 parent 26905fb commit 143c7d8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cli/src/server/basis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ impl Basis {
self.start_tunnel(
locator.clone(),
&persisted,
self.client.clone(),
LookupAccessTokenProvider::new(
self.client.clone(),
locator,
Expand Down Expand Up @@ -592,9 +593,15 @@ impl Basis {
cluster: cluster.to_string(),
};

let mut mgmt = new_tunnel_management(self.client.user_agent());
mgmt.authorization(tunnels::management::Authorization::Tunnel(
host_token.to_string(),
));

self.start_tunnel(
tunnel_details.locator(),
&tunnel_details,
mgmt.into(),
StaticAccessTokenProvider::new(host_token.to_string()),
)
.await
Expand All @@ -604,10 +611,10 @@ impl Basis {
&mut self,
locator: TunnelLocator,
tunnel_details: &PersistedTunnel,
client: TunnelManagementClient,
access_token: impl AccessTokenProvider + 'static,
) -> Result<BasisTunnel, AnyError> {
let mut manager =
BasisTunnelManager::new(self.log.clone(), self.client.clone(), locator, access_token);
let mut manager = BasisTunnelManager::new(self.log.clone(), client, locator, access_token);

let endpoint_result = spanf!(
self.log,
Expand Down

0 comments on commit 143c7d8

Please sign in to comment.