Files
Ruslan KonviserandClaude Opus 5.5 bacaa59de1 fix(devops): Codespaces URLs survive the API's .env.local
The API and the worker load the tracked .env.local with override, so
its localhost API_BASE_URL and CLIENT_BASE_URL replaced the forwarded
Codespaces URLs that the dev container exported: the API handed out
localhost links (uploaded files, e-mails) a browser in a codespace
cannot open.

- apps/api and apps/worker load-env: ENV_LOCAL_NO_OVERRIDE names
  variables whose value in the starting environment .env.local does
  not override. Opt-in; without it nothing changes, and a list written
  in .env or .env.local has no effect.
- .devcontainer/codespaces-env.sh lists the URLs it sets there. It now
  leaves alone any value you set yourself: in the shell, or in .env or
  .env.local to anything but the localhost default. postCreateCommand
  passes it the workspace folder.
- Cases for both loaders (jest) and for the script (node --test, bash),
  including the tracked .env.local's values counting as defaults.

Refs #5570

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 04:38:21 +01:00

61 lines
2.1 KiB
JSON

// Ever Gauzy development container: VS Code Dev Containers, GitHub Codespaces and other tools that read
// devcontainer.json (https://containers.dev/implementors/json_reference/).
//
// After the container is created (`yarn bootstrap` runs once, it takes a while), start the API and the web UI with
// `yarn start`; they use SQLite by default (see .env.local). For PostgreSQL, Redis, MinIO and the other services, run
// `docker compose -f docker-compose.infra.yml up -d` inside the container.
{
"name": "Ever Gauzy",
// Node 26 (the major pinned in .nvmrc) with Yarn 1.22, on Debian.
"image": "mcr.microsoft.com/devcontainers/javascript-node:5-26-trixie",
"features": {
// Docker inside the container, so docker-compose.infra.yml's bind mounts resolve and its published ports
// (5432, 6379, 9000, ...) are reachable from the API on localhost.
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
// The monorepo build (Nx, Angular, the API) needs memory: smaller machines run out of it.
"hostRequirements": {
"cpus": 4,
"memory": "16gb",
"storage": "64gb"
},
"forwardPorts": [3000, 4200],
"portsAttributes": {
"3000": {
"label": "API",
"onAutoForward": "notify"
},
"4200": {
"label": "Web UI",
"onAutoForward": "openBrowser"
}
},
"postCreateCommand": {
"dependencies": "yarn bootstrap",
// In GitHub Codespaces, the API and web UI URLs the browser can reach (see codespaces-env.sh); nothing elsewhere.
"codespaces-urls": "echo '. \"${containerWorkspaceFolder}/.devcontainer/codespaces-env.sh\" \"${containerWorkspaceFolder}\"' | tee -a ~/.bashrc ~/.zshrc > /dev/null"
},
"customizations": {
"vscode": {
// The editor tooling this repository's formatting and lint rely on; .vscode/extensions.json still offers
// the rest of its recommendations.
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
"angular.ng-template",
"nrwl.angular-console",
"firsttris.vscode-jest-runner",
"stylelint.vscode-stylelint"
]
}
}
}