From c607a5c3d0098c3b717cbb28facf061937ec85a4 Mon Sep 17 00:00:00 2001 From: Raphael C Date: Sat, 16 Dec 2023 15:14:26 +0100 Subject: [PATCH] feat: take google SA from env path --- src/features/gemini.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/features/gemini.rs b/src/features/gemini.rs index 8e9def7..44147f3 100644 --- a/src/features/gemini.rs +++ b/src/features/gemini.rs @@ -8,7 +8,9 @@ use crate::core::commands::{CallBackParams, CallbackReturn}; static TOKEN: OnceCell = OnceCell::const_new(); async fn get_token() -> AccessToken { - let creds = yup_oauth2::read_service_account_key("blackfoot-dev-bd1f97a0d61e.json") + let key_path = std::env::var("GOOGLE_APPLICATION_CREDENTIALS") + .unwrap_or_else(|_| "blackfoot-dev-bd1f97a0d61e.json".to_string()); + let creds = yup_oauth2::read_service_account_key(key_path) .await .unwrap(); let sa = ServiceAccountAuthenticator::builder(creds)