Files
ROLAC/APP/src/environments
Chris Chen f55807fa7d wip
2026-06-20 15:13:23 -07:00
..
wip
2026-06-20 15:13:23 -07:00
WIP
2026-05-27 07:49:26 -07:00
WIP
2026-05-25 17:32:18 -07:00

Environment Configuration

This directory contains environment-specific configuration files for the Angular application.

Files

  • environment.ts - Development environment configuration
  • environment.prod.ts - Production environment configuration

API Configuration

The API base URL is configured in these environment files and accessed through the ApiConfigService.

Development

export const environment = {
  production: false,
  apiUrl: 'http://localhost:21860/api'
};

Production

export const environment = {
  production: true,
  apiUrl: 'https://your-production-api.com/api'
};

Usage

Instead of hardcoding API URLs, use the ApiConfigService:

import { ApiConfigService } from '../core/services/api-config.service';

constructor(private apiConfig: ApiConfigService) {}

// Get specific endpoint URLs
const authUrl = this.apiConfig.authUrl; // http://localhost:21860/api/Auth
const usersUrl = this.apiConfig.usersUrl; // http://localhost:21860/api/Users

// Or build custom URLs
const customUrl = this.apiConfig.getApiUrl('CustomEndpoint'); // http://localhost:21860/api/CustomEndpoint

Benefits

  1. Environment-specific URLs: Different URLs for development, staging, and production
  2. Centralized configuration: All API URLs managed in one place
  3. Type safety: TypeScript support for configuration
  4. Easy maintenance: Change URLs without touching service code
  5. Build-time optimization: Angular replaces environment variables at build time