mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-06 02:48:25 +00:00
Change SEGMENT_API_URL to SEGMENT_BASE_URL and append endpoint path
Store only the base URL (e.g. https://api.segment.io) so that different endpoints (/v1/batch, /v1/track, etc.) can reuse it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
04424017b2
commit
5c047beaeb
1 changed files with 3 additions and 3 deletions
|
|
@ -6,9 +6,9 @@ use uuid::Uuid;
|
|||
|
||||
use crate::event::Track;
|
||||
|
||||
const SEGMENT_API_URL: &str = match option_env!("SEGMENT_API_URL") {
|
||||
const SEGMENT_BASE_URL: &str = match option_env!("SEGMENT_BASE_URL") {
|
||||
Some(url) => url,
|
||||
None => "https://api.segment.io/v1/batch",
|
||||
None => "https://api.segment.io",
|
||||
};
|
||||
const SEGMENT_WRITE_KEY: Option<&str> = option_env!("SEGMENT_WRITE_KEY");
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ pub async fn upload(path: &Path) -> anyhow::Result<()> {
|
|||
let auth = STANDARD.encode(format!("{write_key}:"));
|
||||
|
||||
let resp = reqwest::Client::new()
|
||||
.post(SEGMENT_API_URL)
|
||||
.post(format!("{SEGMENT_BASE_URL}/v1/batch"))
|
||||
.header("Authorization", format!("Basic {auth}"))
|
||||
.json(&payload)
|
||||
.send()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue