Skip to content

Commit 818a272

Browse files
committed
chore: update globe auth api & improve error
1 parent b3a96c5 commit 818a272

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/auth.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ impl DbAuthStrategy for GlobeStrategy {
2020
) -> Pin<Box<dyn Future<Output = Result<TursoConfig, Box<dyn std::error::Error>>> + Send + 'a>>
2121
{
2222
Box::pin(async move {
23-
let globe_auth_api = std::env::var("GLOBE_DS_API")?;
23+
let globe_auth_api = std::env::var("GLOBE_DS_API")
24+
.map_err(|_| "GLOBE_DS_API environment variable not set")?;
2425

2526
let clean_db_name = db_name.split('.').next().unwrap_or(db_name);
26-
let request_body = serde_json::json!({ "db_name": clean_db_name });
2727

2828
let response = client
29-
.post(format!("{}/db/auth", globe_auth_api))
30-
.body(request_body.to_string())
29+
.get(format!("{}/db/{}/get_auth", globe_auth_api, clean_db_name))
3130
.send()
3231
.await
3332
.map_err(|_| "Failed to fetch auth credentials for database")?;

0 commit comments

Comments
 (0)