Skip to content

Resolve service URLs from explicit config; deprecate HOSTNAME - #53

Merged
nycomp merged 1 commit into
mainfrom
deprecate/hostname-base-urls
Oct 1, 2026
Merged

nycomp merged 1 commit into
mainfrom
deprecate/hostname-base-urls

Conversation

@nycomp

@nycomp nycomp commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the mitigation from #52: base URLs for the auth and api services are no longer derived from env.HOSTNAME.

New resolution order (per service, campus_python/__init__.py):

  1. Explicit URL config: CAMPUS_AUTH_URL / CAMPUS_API_URL env vars — mirrors campus-cli@7b2e895 (CAMPUS_AUTH_URL / auth_url config key).
  2. ENV/CAMPUS_ENV defaults: development → Railway dev deployments (default), staging → *.campus.nyjc.dev, production → *.campus.nyjc.app.

Deprecation transition (per the issue): the DEPLOY-suffix and testing branches that produced https://{HOSTNAME} are removed. When a deployment still presents those settings (DEPLOY ending in .auth/.api, or ENV/CAMPUS_ENV=testing) without explicit URL config, a DeprecationWarning is emitted and the ENV-based default applies. The warning path itself can be dropped in a follow-up once downstream has migrated.

Tests

  • 14 new unit tests in tests/unit/test_base_url_resolution.py pin the contract: explicit config precedence (incl. over ENV=production), ENV/CAMPUS_ENV defaults, DeprecationWarning for legacy settings, no warning when explicit config is set, invalid ENV → ValueError.
  • Full suite: 107 passed.

Docs

Downstream coordination

Per the issue audit, nyxchange-timetable-v2 (pins from main) and campus-suite (weekly) install this client. Deployments hitting non-default endpoints (local testing, in-service self-calls via DEPLOY) must set CAMPUS_AUTH_URL / CAMPUS_API_URL — the deprecation warning names the exact var to set.

Fixes #52

…STNAME (issue #52)

Service base URLs are now resolved per service in this order:

1. Explicit URL config: CAMPUS_AUTH_URL / CAMPUS_API_URL env vars
   (mirrors campus-cli's CAMPUS_AUTH_URL / auth_url config key).
2. ENV/CAMPUS_ENV defaults: development Railway deployments,
   staging (campus.nyjc.dev) and production (campus.nyjc.app).

The DEPLOY-suffix and testing branches that built https://{HOSTNAME}
URLs are removed: HOSTNAME is a container hostname, not a routable
domain, and the f-string dropped the port. Deployments relying on
those settings now get a DeprecationWarning and the ENV-based default
instead; the warning path will be removed once downstream consumers
(nyxchange-timetable-v2, campus-suite) set explicit URL config.

14 unit tests pin the resolution contract; README documents the
env vars and resolution order.
@nycomp
nycomp merged commit 74da7c0 into main Oct 1, 2026
2 checks passed
@nycomp
nycomp deleted the deprecate/hostname-base-urls branch October 1, 2026 03:12
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.

Deprecate env.HOSTNAME-based base URL resolution in campus_python client

2 participants