Testing Environments Configuration

The Agranelos BFF Postman collection now includes comprehensive support for multiple environments, enabling seamless switching between local development, containerized testing, and cloud deployments.

Environment Overview

graph TB
    A[Postman Collection] --> B[Local Environment]
    A --> C[Docker Environment]
    A --> D[AWS Environment]
    A --> E[Azure Environment]
    
    B --> F[http://localhost:8080]
    C --> G[Container Port 8080]
    D --> H[AWS Deployment URLs]
    E --> I[Azure App Services]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8
    style D fill:#fff3e0
    style E fill:#f1f8e9

Collection Status

Current Implementation

The collection includes:

Environment Support

Four environment files available:

  1. Local - http://localhost:8080 (local development)
  2. Docker/Podman - http://localhost:8080 (containerized)
  3. AWS - Configurable for AWS deployment
  4. Azure - Configurable for Azure deployment

File Structure

postman/
├── README.md                        # Usage guide
├── Local.postman_environment.json   # Local environment
├── Docker.postman_environment.json  # Container environment
├── AWS.postman_environment.json     # AWS environment
└── Azure.postman_environment.json   # Azure environment

Main collection:

Setup Instructions

Import Collection and Environments

  1. Open Postman
  2. Click “Import”
  3. Select Agranelos-BFF.postman_collection.json
  4. Import all files from postman/ directory
  5. Click “Import”

Select Environment

Use the dropdown in the top-right corner of Postman:

Local Development (Spring Boot):

Container Testing (Docker/Podman):

AWS Deployment:

Azure Deployment:

Cloud Configuration

AWS Environment Setup

  1. Click the environment icon (eye symbol)
  2. Click Edit on “AWS Environment”
  3. Update base_url:
// Load Balancer
"base_url": "https://api.agranelos.com"

// API Gateway + Lambda
"base_url": "https://abc123.execute-api.us-east-1.amazonaws.com/prod"

// Elastic Beanstalk
"base_url": "http://agranelos-bff.us-east-1.elasticbeanstalk.com"

// ECS/Fargate with ALB
"base_url": "https://agranelos-alb-123456.us-east-1.elb.amazonaws.com"

Azure Environment Setup

  1. Click the environment icon
  2. Click Edit on “Azure Environment”
  3. Update base_url:
// Azure App Service
"base_url": "https://agranelos-bff.azurewebsites.net"

// Azure Container Instances
"base_url": "http://agranelos-bff.eastus.azurecontainer.io"

// Azure Kubernetes Service
"base_url": "https://agranelos.eastus.cloudapp.azure.com"

// Azure Front Door
"base_url": "https://agranelos-bff.azurefd.net"

Environment Variables

All configurations include these variables:

Variable Description Default Value
base_url BFF base URL Varies by environment
producto_id Product ID for testing 1
bodega_id Warehouse ID for testing 1
username HTTP Basic username user
password HTTP Basic password myStrongPassword123
environment Environment identifier local, aws, azure, docker

Security Considerations

Production Credentials

For production environments:

  1. Avoid committing real passwords:
    "password": {
      "value": "",
      "type": "secret"
    }
    
  2. Use Postman Cloud encryption:
    • Secret-type variables are encrypted
    • Not exported in plain text
  3. Use local variables:
    • Set “Current Value” instead of “Initial Value”
    • Current values are not exported or shared

Usage Examples

Local Testing

# Start Spring Boot
mvn spring-boot:run

# In Postman:
# - Select "Local Environment"
# - Execute any request

Container Testing

# Start container
podman run -d --name agranelos-bff -p 8080:8080 \
  -e AZURE_FUNCTIONS_BASE_URL="https://..." \
  agranelos-bff:latest

# In Postman:
# - Select "Docker/Podman Environment"
# - Execute any request

AWS Testing

# Configure base_url with your AWS URL
# In Postman:
# - Select "AWS Environment"
# - Update base_url if necessary
# - Execute any request

Development Workflow

sequenceDiagram
    participant Dev as Developer
    participant Local as Local Env
    participant Docker as Container
    participant AWS as AWS Staging
    participant Prod as Production
    
    Dev->>Local: Develop & Test
    Dev->>Docker: Container Testing
    Dev->>AWS: Staging Validation
    Dev->>Prod: Production Deployment
    
    Note over Dev,Prod: Switch environments easily in Postman

Environment Progression

  1. Development:
    • Use “Local Environment”
    • Develop and test locally
  2. Container Testing:
    • Use “Docker/Podman Environment”
    • Test image before deployment
  3. Staging:
    • Copy “AWS Environment” to “AWS Staging”
    • Configure staging URL
    • Run integration tests
  4. Production:
    • Use “AWS Environment”
    • Production URL configured
    • Execute smoke tests and monitoring

Environment Management

Quick Environment Switching

  1. Keyboard shortcuts:
    • Ctrl/Cmd + E to change environment
  2. Duplicate environments:
    • Right-click → Duplicate
    • Useful for staging vs production separation
  3. Share environments:
    • Export → Share with team
    • Import in other workspaces

Adding New Environments

  1. Duplicate existing environment file:
    cp postman/Local.postman_environment.json postman/Production.postman_environment.json
    
  2. Edit values:
    {
      "name": "Production",
      "values": [
        {
          "key": "base_url",
          "value": "https://prod.agranelos.com"
        }
      ]
    }
    
  3. Import in Postman

Troubleshooting

Environment Not Visible

Requests Going to Wrong URL

Authentication Errors

Connection Issues

Improvements Summary

Previous State

Current State

Maintenance

Collection Updates

  1. Export from Postman (Collection v2.1)
  2. Replace Agranelos-BFF.postman_collection.json
  3. Commit and push changes

Environment Updates

  1. Modify environment files directly
  2. Re-import in Postman
  3. Or use Postman’s environment editor

Resources


Documentation Version: 2.0.0
Last Updated: October 12, 2025
Environments Supported: Local, Docker/Podman, AWS, Azure