Skip to content

fix: make OPS_FRONTEND_URL configurable via environment variable#5469

Merged
fpigeonjr merged 2 commits into
mainfrom
ops-5454/para-worktrees
Apr 13, 2026
Merged

fix: make OPS_FRONTEND_URL configurable via environment variable#5469
fpigeonjr merged 2 commits into
mainfrom
ops-5454/para-worktrees

Conversation

@fpigeonjr

@fpigeonjr fpigeonjr commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

What changed

OPS_FRONTEND_URL was hardcoded to http://localhost:3000 in backend/ops_api/ops/environment/default_settings.py. It is now read from the environment with http://localhost:3000 as the fallback default, matching the pattern already used by all Azure environment configs.

docker-compose.yml now passes OPS_FRONTEND_URL=http://localhost:${FRONTEND_PORT:-3000} to the backend container so the value automatically tracks FRONTEND_PORT with no extra override needed.

AGENTS.md has been updated to include OPS_FRONTEND_URL in the alternate-port worktree example command and the port variables reference table.

Web UI contributors: If you edited files via the GitHub web interface on a branch in this repository, CI can automatically apply any needed formatting fixes and commit them back to your PR branch. Fork-based PRs may still need local formatting — see CONTRIBUTING.md for details.

Issue

Closes #5454

How to test

  1. Start the stack on alternate ports:
    COMPOSE_PROJECT_NAME=ops_5454 \
    DB_PORT=55432 \
    BACKEND_PORT=58080 \
    FRONTEND_PORT=53000 \
    BACKEND_DOMAIN=http://localhost:58080 \
    OPS_FRONTEND_URL=http://localhost:53000 \
    docker compose --profile setup up --build
  2. Confirm the env var is live in the backend container:
    COMPOSE_PROJECT_NAME=ops_5454 FRONTEND_PORT=53000 docker compose exec backend env | grep OPS_FRONTEND_URL
    # Expected: OPS_FRONTEND_URL=http://localhost:53000
  3. Open http://localhost:53000 and log in — should succeed with no CORS or 401 errors.
  4. Run the default stack (docker compose --profile setup up --build) and confirm login still works at http://localhost:3000.

A11y impact

  • No accessibility-impacting changes in this PR

Screenshots

N/A — backend config and Docker Compose change only

Definition of Done Checklist

  • OESA: Code refactored for clarity
  • OESA: Dependency rules followed
  • Automated unit tests updated and passed
  • Automated integration tests updated and passed
  • Automated quality tests updated and passed
  • Automated load tests updated and passed
  • Automated a11y tests updated and passed
  • Automated security tests updated and passed
  • 90%+ Code coverage achieved
  • Form validations updated

Links

@fpigeonjr fpigeonjr added tech-debt Resolved technical debt (tooling, configuration, or workflow) python Pull requests that update Python code labels Apr 9, 2026
@fpigeonjr fpigeonjr self-assigned this Apr 9, 2026
@fpigeonjr fpigeonjr requested a review from Copilot April 9, 2026 17:39

Copilot AI 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.

Pull request overview

This PR makes the backend’s expected frontend origin (OPS_FRONTEND_URL) configurable via environment variable (defaulting to http://localhost:3000) to prevent CORS / Referer-origin mismatches when running the stack on alternate ports.

Changes:

  • Read OPS_FRONTEND_URL from the environment in backend default settings with a localhost fallback.
  • Pass a derived OPS_FRONTEND_URL into the backend container via docker-compose.yml based on FRONTEND_PORT.
  • Update AGENTS.md to document OPS_FRONTEND_URL for alternate-port workflows.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
backend/ops_api/ops/environment/default_settings.py Switches OPS_FRONTEND_URL from hardcoded to env-driven with a default.
docker-compose.yml Injects OPS_FRONTEND_URL into the backend container derived from FRONTEND_PORT.
AGENTS.md Documents OPS_FRONTEND_URL and adds it to the alternate-port example.
frontend/src/pages/help/HelpCenter.jsx Updates Help Center “Open in SharePoint” link styling/icon (unrelated to PR purpose).
backend/ops_api/Pipfile.lock Updates lockfile with multiple dependency version changes (unrelated to PR purpose).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.yml Outdated
Comment thread frontend/src/pages/help/HelpCenter.jsx
Comment thread AGENTS.md
Read OPS_FRONTEND_URL from the environment in default_settings.py with
http://localhost:3000 as the fallback, matching the pattern used by all
Azure environment configs.

docker-compose.yml passes OPS_FRONTEND_URL using defaulted substitution
so FRONTEND_PORT auto-derives the value and an explicit host override is
honored when set.

AGENTS.md documents OPS_FRONTEND_URL in the alternate-port example and
clarifies that FRONTEND_PORT alone is sufficient for localhost workflows.

Closes #5454
@fpigeonjr fpigeonjr force-pushed the ops-5454/para-worktrees branch from 52b70aa to d96a0d1 Compare April 9, 2026 17:56
The pre-commit hook regenerated the lock file hash using local Python
3.14.4, but CI builds with python:3.14.2-alpine3.22 which computes a
different hash. Restoring to the main baseline so pipenv install
--deploy succeeds in CI.
@fpigeonjr fpigeonjr marked this pull request as ready for review April 9, 2026 18:19
@fpigeonjr fpigeonjr merged commit 7d63665 into main Apr 13, 2026
58 checks passed
@fpigeonjr fpigeonjr deleted the ops-5454/para-worktrees branch April 13, 2026 20:09
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.355.11 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code released tech-debt Resolved technical debt (tooling, configuration, or workflow)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OPS_FRONTEND_URL is hardcoded — breaks CORS when running on alternate ports

4 participants