From 6d22aa0a459b1e6354963a553a4fecb63c1fce1c Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Wed, 29 Oct 2025 17:30:27 -0400 Subject: [PATCH] Use the standard ZOO_API_TOKEN environment variable --- .envrc | 5 ++++- .github/workflows/ci.yml | 2 +- modeling-session/examples/cube_png.rs | 8 +++++--- modeling-session/examples/cube_png_batch.rs | 8 +++++--- modeling-session/examples/lsystem_png_batch.rs | 8 +++++--- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.envrc b/.envrc index a5dbbcba..1d133841 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,4 @@ -use flake . +# Enable nix development environment if installed +if has nix; then + use flake . +fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e7f3ccb..44b2f0b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - name: cargo test shell: bash run: | - export KITTYCAD_API_TOKEN=${{secrets.KITTYCAD_API_TOKEN}} + export ZOO_API_TOKEN=${{secrets.KITTYCAD_API_TOKEN}} just test-with-coverage env: RUST_BACKTRACE: 1 diff --git a/modeling-session/examples/cube_png.rs b/modeling-session/examples/cube_png.rs index 3a764074..65cffae5 100644 --- a/modeling-session/examples/cube_png.rs +++ b/modeling-session/examples/cube_png.rs @@ -20,14 +20,16 @@ const CUBE_WIDTH: LengthUnit = LengthUnit(100.0); #[tokio::main(flavor = "current_thread")] async fn main() -> Result<()> { // Set up the API client. - let kittycad_api_token = env::var("KITTYCAD_API_TOKEN").context("You must set $KITTYCAD_API_TOKEN")?; - let kittycad_api_client = kittycad::Client::new(kittycad_api_token); + let token = env::var("ZOO_API_TOKEN") + .or_else(|_| env::var("KITTYCAD_API_TOKEN")) // legacy name + .context("You must set $ZOO_API_TOKEN")?; + let client = kittycad::Client::new(token); // Where should the final PNG be saved? let img_output_path = env::var("IMAGE_OUTPUT_PATH").unwrap_or_else(|_| "model.png".to_owned()); let session_builder = SessionBuilder { - client: kittycad_api_client, + client, fps: Some(10), unlocked_framerate: Some(false), video_res_height: Some(720), diff --git a/modeling-session/examples/cube_png_batch.rs b/modeling-session/examples/cube_png_batch.rs index 32a3fef3..dfa77936 100644 --- a/modeling-session/examples/cube_png_batch.rs +++ b/modeling-session/examples/cube_png_batch.rs @@ -21,14 +21,16 @@ const CUBE_WIDTH: LengthUnit = LengthUnit(100.0); #[tokio::main(flavor = "current_thread")] async fn main() -> Result<()> { // Set up the API client. - let kittycad_api_token = env::var("KITTYCAD_API_TOKEN").context("You must set $KITTYCAD_API_TOKEN")?; - let kittycad_api_client = kittycad::Client::new(kittycad_api_token); + let token = env::var("ZOO_API_TOKEN") + .or_else(|_| env::var("KITTYCAD_API_TOKEN")) // legacy name + .context("You must set $ZOO_API_TOKEN")?; + let client = kittycad::Client::new(token); // Where should the final PNG be saved? let img_output_path = env::var("IMAGE_OUTPUT_PATH").unwrap_or_else(|_| "model_batched.png".to_owned()); let session_builder = SessionBuilder { - client: kittycad_api_client, + client, fps: Some(10), unlocked_framerate: Some(false), video_res_height: Some(720), diff --git a/modeling-session/examples/lsystem_png_batch.rs b/modeling-session/examples/lsystem_png_batch.rs index a26aa4f7..2e9a30e1 100644 --- a/modeling-session/examples/lsystem_png_batch.rs +++ b/modeling-session/examples/lsystem_png_batch.rs @@ -20,14 +20,16 @@ use uuid::Uuid; #[tokio::main(flavor = "current_thread")] async fn main() -> Result<()> { // Set up the API client. - let kittycad_api_token = env::var("KITTYCAD_API_TOKEN").context("You must set $KITTYCAD_API_TOKEN")?; - let kittycad_api_client = kittycad::Client::new(kittycad_api_token); + let token = env::var("ZOO_API_TOKEN") + .or_else(|_| env::var("KITTYCAD_API_TOKEN")) // legacy name + .context("You must set $ZOO_API_TOKEN")?; + let client = kittycad::Client::new(token); // Where should the final PNG be saved? let img_output_path = env::var("IMAGE_OUTPUT_PATH").unwrap_or_else(|_| "model_lsystem_batched.png".to_owned()); let session_builder = SessionBuilder { - client: kittycad_api_client, + client, fps: Some(10), unlocked_framerate: Some(false), video_res_height: Some(720),