Skip to content

feat: Add APIFY_CONSOLE_URL env variable for local actor runtime#1276

Merged
Pijukatel merged 9 commits into
masterfrom
claude/hardcoded-apify-urls-cli-e7jnyj
Jul 22, 2026
Merged

feat: Add APIFY_CONSOLE_URL env variable for local actor runtime#1276
Pijukatel merged 9 commits into
masterfrom
claude/hardcoded-apify-urls-cli-e7jnyj

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This will be used when using CLI against the local actor runtime development environment.

Partially related to: #1214

claude added 6 commits July 10, 2026 13:10
The CLI printed `https://console.apify.com` links (run/build/dataset/KVS URLs,
`apify call` / `apify actors start` output, `apify push`, and the `apify login`
browser flow) with the host hardcoded, so pointing the CLI at a non-production
environment via `APIFY_CLIENT_BASE_URL` still produced production Console links.

Add a shared `getConsoleUrl()` helper that resolves the Console base URL from
the environment: an explicit `APIFY_CONSOLE_URL` override wins, otherwise it is
derived from `APIFY_CLIENT_BASE_URL` by swapping the `api.` host for `console.`,
falling back to the production Console. All previously hardcoded call sites now
use it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
When the Console is a localhost instance (local platform development), default
token validation to the local API on port 3333 — the coupling the previous
commit dropped. An explicit APIFY_CLIENT_BASE_URL still overrides it, so the
"local Console ⇒ local API" convenience is back without hardcoding the pairing
in source: both endpoints are driven by APIFY_CONSOLE_URL / APIFY_CLIENT_BASE_URL.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
Add a "CLI configuration environment variables" section to the environment
variables page covering the API/Console base URL overrides, how the Console URL
is derived from APIFY_CLIENT_BASE_URL, and the localhost login convenience.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
Replace the login-only getLoginApiBaseUrl with a shared getApiBaseUrl in
console-url.ts and route the ApifyClient creation in utils.ts through it, so the
"localhost Console => local API on :3333" default applies to every command, not
just login. An explicit APIFY_CLIENT_BASE_URL still overrides it.

As a result, setting APIFY_CONSOLE_URL to a localhost instance now also points
the API at localhost by default across the whole CLI. Docs and tests updated to
match; the login command no longer needs its own resolver.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
The Console URL is now driven only by APIFY_CONSOLE_URL (or the production
default); it is no longer inferred from APIFY_CLIENT_BASE_URL by swapping the
api. host. The localhost Console => local API on :3333 fallback is kept, which
already covers the local development case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
Remove the getApiBaseUrl helper and its CLI-wide use; the ApifyClient once
again reads process.env.APIFY_CLIENT_BASE_URL directly in utils.ts, exactly as
before. The localhost => local API on :3333 fallback returns to its original
login-only scope (now keyed off the resolved Console URL). The Console URL work
driven by APIFY_CONSOLE_URL is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM

@l2ysho l2ysho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems solid 🚀. Just one nit, also lets wait for @DaveHanns to take a look.

Comment thread src/lib/console-url.ts
Co-authored-by: Richard Solar <solar.richard@gmail.com>
@github-actions github-actions Bot added this to the 145th sprint - Tooling team milestone Jul 16, 2026
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Jul 16, 2026
Collapse the multi-line throw introduced by the accepted review suggestion so
it matches oxfmt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AqvuTQpZK5N9EiUuU2NAzM
@Pijukatel Pijukatel added the adhoc Ad-hoc unplanned task added during the sprint. label Jul 16, 2026

@szaganek szaganek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some fluff sweeping from me :)

Comment thread docs/vars.md Outdated
Comment thread docs/vars.md Outdated
Co-authored-by: Edyta <142720610+szaganek@users.noreply.github.com>
@Pijukatel
Pijukatel merged commit 79ad1a0 into master Jul 22, 2026
23 checks passed
@Pijukatel
Pijukatel deleted the claude/hardcoded-apify-urls-cli-e7jnyj branch July 22, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants