[PR #43] [MERGED] feat!: configure the base URL via COMFY_BASE_URL instead of a constructor argument #51

Closed
opened 2026-10-31 22:04:09 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-typescript-sdk/pull/43
Author: @wei-hai
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @wei-hai

Base: main ← Head: wei/be-6958-sdk-base-url-env-var


📝 Commits (3)

  • 555b833 feat!: configure the base URL via COMFY_BASE_URL, not a constructor argument
  • 328f7bd fix: address review — test the request target, isolate ambient env
  • 977a116 fix: reject a base URL carrying a query or fragment

📊 Changes

8 files changed (+190 additions, -66 deletions)

View changed files

📝 README.md (+33 -14)
📝 src/index.test.ts (+9 -3)
📝 src/index.ts (+4 -4)
➕ src/sdk/baseUrlEnv.test.ts (+81 -0)
📝 src/sdk/client.test.ts (+7 -3)
📝 src/sdk/client.ts (+55 -19)
➖ src/sdk/defaultBaseUrl.test.ts (+0 -22)
📝 src/sdk/index.ts (+1 -1)

📄 Description

new Comfy() targets Comfy Cloud; another deployment is selected with the COMFY_BASE_URL environment variable. The base-URL constructor overload is removed, so an arbitrary endpoint is no longer part of the call surface.

Breaking: new Comfy(baseUrl, opts) → new Comfy(opts) + COMFY_BASE_URL. TypeScript callers get a compile error; untyped JS callers get a TypeError rather than a silently ignored argument.

The variable is read per construction (not at module load), must be an http(s) URL, and unset-or-blank means Comfy Cloud.

Scope: the public Comfy client only. ComfyLow (@comfyorg/sdk/low, the documented escape hatch) still takes a base URL — it is what the client builds on.

Verified: pnpm lint, format:check, typecheck, test (148 pass), test:coverage, check-spec-drift, check-public-repo-hygiene, build.

Matching change in comfy-python-sdk keeps the two SDKs in lockstep.

Summary by CodeRabbit

  • New Features

    • Added environment-based endpoint configuration through COMFY_BASE_URL.
    • Comfy Cloud is now the default deployment target.
    • Added an exported constant identifying the endpoint environment variable.
    • Added validation for HTTP(S) endpoints, including whitespace handling.
  • Documentation

    • Updated setup, authentication, deployment, and local proxy configuration examples.
    • Documented the new options-based client initialization.
  • Bug Fixes

    • Invalid or unsupported endpoint values now produce clear errors.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-typescript-sdk/pull/43 **Author:** [@wei-hai](https://github.com/wei-hai) **Created:** 8/11/2026 **Status:** ✅ Merged **Merged:** 8/11/2026 **Merged by:** [@wei-hai](https://github.com/wei-hai) **Base:** `main` ← **Head:** `wei/be-6958-sdk-base-url-env-var` --- ### 📝 Commits (3) - [`555b833`](https://github.com/Comfy-Org/comfy-typescript-sdk/commit/555b833839ba7748bb4e7aa1f1decc9332fdcbfc) feat!: configure the base URL via COMFY_BASE_URL, not a constructor argument - [`328f7bd`](https://github.com/Comfy-Org/comfy-typescript-sdk/commit/328f7bd12f04e1d425340b684b30dfa8a9562a16) fix: address review — test the request target, isolate ambient env - [`977a116`](https://github.com/Comfy-Org/comfy-typescript-sdk/commit/977a116fe0e6628011d89d6d45c778d9b6fca308) fix: reject a base URL carrying a query or fragment ### 📊 Changes **8 files changed** (+190 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+33 -14) 📝 `src/index.test.ts` (+9 -3) 📝 `src/index.ts` (+4 -4) ➕ `src/sdk/baseUrlEnv.test.ts` (+81 -0) 📝 `src/sdk/client.test.ts` (+7 -3) 📝 `src/sdk/client.ts` (+55 -19) ➖ `src/sdk/defaultBaseUrl.test.ts` (+0 -22) 📝 `src/sdk/index.ts` (+1 -1) </details> ### 📄 Description `new Comfy()` targets Comfy Cloud; another deployment is selected with the `COMFY_BASE_URL` environment variable. The base-URL constructor overload is removed, so an arbitrary endpoint is no longer part of the call surface. **Breaking:** `new Comfy(baseUrl, opts)` → `new Comfy(opts)` + `COMFY_BASE_URL`. TypeScript callers get a compile error; untyped JS callers get a `TypeError` rather than a silently ignored argument. The variable is read per construction (not at module load), must be an `http(s)` URL, and unset-or-blank means Comfy Cloud. Scope: the public `Comfy` client only. `ComfyLow` (`@comfyorg/sdk/low`, the documented escape hatch) still takes a base URL — it is what the client builds on. Verified: `pnpm lint`, `format:check`, `typecheck`, `test` (148 pass), `test:coverage`, `check-spec-drift`, `check-public-repo-hygiene`, `build`. Matching change in `comfy-python-sdk` keeps the two SDKs in lockstep. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added environment-based endpoint configuration through `COMFY_BASE_URL`. * Comfy Cloud is now the default deployment target. * Added an exported constant identifying the endpoint environment variable. * Added validation for HTTP(S) endpoints, including whitespace handling. * **Documentation** * Updated setup, authentication, deployment, and local proxy configuration examples. * Documented the new options-based client initialization. * **Bug Fixes** * Invalid or unsupported endpoint values now produce clear errors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 22:04:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-typescript-sdk#51
No description provided.