Galactic Tournament uses Angular’s built-in environment file system to manage configuration values — most importantly the backend API base URL — across different build targets. Understanding how these files work is essential before deploying the app or contributing to it locally.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/HectorDNC/galactic-tournament-front/llms.txt
Use this file to discover all available pages before exploring further.
How Angular Environment Files Work
Angular supports multiple named build configurations (defined inangular.json). Each configuration can declare fileReplacements — a list of source files to swap out at build time. The app always imports from environment.ts, but the Angular compiler silently replaces that file with the environment-specific version before bundling.
The three environment files live in src/app/environments/:
| File | Used when |
|---|---|
environment.ts | Default — also the Docker injection target |
environment.development.ts | ng serve --configuration development / pnpm run dev |
environment.prod.ts | ng build / pnpm build (production configuration) |
angular.json under projects > ng-tailadmin > architect > build > configurations:
The
serve target’s defaultConfiguration is "development", and the build target’s defaultConfiguration is "production". Running pnpm run dev therefore automatically picks up environment.development.ts, while pnpm build picks up environment.prod.ts.The Environment Files
Each environment file exports a singleenvironment constant. Services import it directly — for example, SpeciesService constructs its base URL as `${environment.api_url}/api/species`.
The api_url Field
api_url is the only application-level configuration value in these files. Every HTTP service in the project prepends it to its endpoint path:
api_url in an environment file automatically redirects all API traffic in that build target — no other files need to be touched.
Switching Configurations with pnpm Scripts
- Development (local backend)
- Default serve (production API)
- Production build
ng serve --configuration development. Angular replaces environment.ts with environment.development.ts, so all API calls go to your local backend at http://localhost:8080. Source maps are enabled and optimizations are disabled for a faster edit-refresh cycle.Docker Build-Time Injection
TheDockerfile uses a two-stage build: a Node builder stage compiles the Angular app, and an Nginx runner stage serves the static output. The builder stage exposes an ARG API_URL that can be overridden at docker build time.
Before running pnpm run build, the Dockerfile injects the API URL directly into environment.ts using sed:
api_url holds with the value of $API_URL, then proceeds with the production build. The result is a bundle baked with exactly the URL you specified at image build time.
Building the Docker Image
Environment Fields Reference
| Field | Type | Description |
|---|---|---|
production | boolean | true only in environment.prod.ts. Can gate debug tooling or logging inside the app. |
api_url | string | Base URL for all backend HTTP requests. No trailing slash. |