Skip to content

Commit

Permalink
rename function back to token
Browse files Browse the repository at this point in the history
  • Loading branch information
hrvolapeter committed Oct 10, 2022
1 parent ed4200e commit a00dcf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gcloud_authorized_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ impl GCloudAuthorizedUser {
pub(crate) async fn new() -> Result<Self, Error> {
let gcloud = which("gcloud").map_err(|_| GCloudNotFound)?;
let project_id = run(&gcloud, &["config", "get-value", "project"]).ok();
let token = RwLock::new(Self::get_token_via_gcloud_cmd(&gcloud)?);
let token = RwLock::new(Self::token(&gcloud)?);
Ok(Self {
gcloud,
project_id,
token,
})
}

fn get_token_via_gcloud_cmd(gcloud: &Path) -> Result<Token, Error> {
fn token(gcloud: &Path) -> Result<Token, Error> {
Ok(Token::from_string(run(
gcloud,
&["auth", "print-access-token", "--quiet"],
Expand All @@ -49,7 +49,7 @@ impl ServiceAccount for GCloudAuthorizedUser {
}

async fn refresh_token(&self, _client: &HyperClient, _scopes: &[&str]) -> Result<Token, Error> {
let token = Self::get_token_via_gcloud_cmd(&self.gcloud)?;
let token = Self::token(&self.gcloud)?;
*self.token.write().unwrap() = token.clone();
Ok(token)
}
Expand Down

0 comments on commit a00dcf3

Please sign in to comment.