Skip to content

Document base-url-env / x-fern-base-url-env for SDK base URL from an environment variable - #7011

Merged
nerminamiller-postman merged 1 commit into
mainfrom
devin/1789751303-base-url-env-docs
Sep 23, 2026
Merged

nerminamiller-postman merged 1 commit into
mainfrom
devin/1789751303-base-url-env-docs

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Generated SDKs can now read their base URL from an environment variable, the same way API keys already default from env vars. The API definition names the variable (base-url-env in api.yml, x-fern-base-url-env in OpenAPI, or base-url-env under api.environments in generators.yml), and the generated client falls back to it when the caller passes neither baseUrl nor environment. This lets customers point one SDK build at staging, production, or a self-hosted deployment via configuration instead of hard-coding or passing a base URL in code. Only the TypeScript SDK generator implements the fallback today, and the docs say so explicitly.

Implements docs for: feat(typescript): read SDK base URL from configured environment variable (fern-api/fern#17736) — fern-api/fern#17736
Implements docs for: feat(cli): add base-url-env for SDK base URL environment variable (fern-api/fern#17705) — fern-api/fern#17705

Pages changed

  • fern/products/api-def/ferndef/api-yml/environments.mdx — new "Base URL from an environment variable" section (canonical home): api.yml example, resolution order (baseUrl > environment > env var > default environment), fern check valid-base-url-env warning, TypeScript-only note.
  • fern/products/api-def/openapi/extensions/server-names.mdx — new ## x-fern-base-url-env section with an openapi.yml example and the precedence rule (generators.yml base-url-env wins over the spec).
  • fern/products/api-def/openapi/extensions/overview.md — table row for x-fern-base-url-env linking to that section.
  • fern/products/sdks/reference/generators-yml-reference.mdx — environments ParamField documents base-url-env, its precedence over x-fern-base-url-env, and that overriding environments alone keeps the spec's value.
  • fern/products/sdks/generators/typescript/configuration.mdx — guardProcessEnvAccess now covers the base URL env read; requireBaseUrl gains a sentence on the client's base URL resolution order (including standalone sub-clients).

Auto-generated changelogs (typescript/changelog/2026-09-16.mdx, cli-changelog/2026-09-15.mdx) were not edited. No Docs-product changelog entry (SDK/API definition feature).

Checks: pre-commit run --files <changed> (Vale passes; remaining findings are pre-existing on untouched lines) and npx fern-api@5.59.0 check --warnings (0 errors).

Link to Devin session: https://app.devin.ai/sessions/dcb35859297d4ee3bddc62db8cf40148
Open in Devin Desktop: https://app.devin.ai/desktop/session/dcb35859297d4ee3bddc62db8cf40148?variant=devin

…om environment variable

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nerminamiller-postman
nerminamiller-postman merged commit b6b6226 into main Sep 23, 2026
5 checks passed
@nerminamiller-postman
nerminamiller-postman deleted the devin/1789751303-base-url-env-docs branch September 23, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant