What are profiles?
A profile is a named configuration overlay that modifies specific aspects of your base WireMock configuration without duplicating the entire configuration structure. Each profile is stored in a separate file namedwiremock-<profile-name>.yaml that sits alongside your base wiremock.yaml configuration. When you activate a profile using the --profile flag, its configuration merges with and overrides matching values in the base configuration.
This overlay mechanism means you define only what changes, not what stays the same.
Why profiles exist
Mock API configurations often need to vary depending on context:- Different target URLs for recording (local, staging, production APIs)
- Different port assignments to avoid conflicts
- Different TLS certificates for security contexts
- Different cloud API IDs for environment isolation
- Different validation modes for testing vs. production use
How profiles work
Configuration overlay
When you specify a profile, WireMock reads both the base configuration and the profile configuration, then merges them. The profile values override any matching base values while inheriting everything else. For example, given this base configuration:wiremock-staging.yaml profile:
--profile staging produces this effective configuration:
cloud_id and the originals.default URL—everything else came from the base configuration.
Profile scope
Profiles can override specific service properties, but they maintain structural constraints:- The same services must exist in both base and profile configurations
- Service structure (service keys/names) cannot change
- The service
typecannot be overridden - New services cannot be added via profiles
Common profile use cases
Recording from different sources: Override theoriginals section to record from different target services—production APIs, staging APIs, or local instances—depending on your current task.
Port conflict avoidance: Change port assignments when multiple developers or processes need to run mock services simultaneously on the same machine.
Security context switching: Apply different TLS certificates or validation modes depending on whether you’re doing local development, integration testing, or simulating production-like behavior.
API specification variants: Use different OpenAPI validation modes—none for exploratory development, soft for testing with warnings, hard for strict contract validation.
Profiles for managing environments
One of the most common uses of profiles is managing environment-specific configurations—development, staging, production, and other deployment contexts where the same logical services need different runtime characteristics.Environment isolation with cloud APIs
When working with WireMock Cloud, different environments typically map to different mock API instances. Astaging profile might override the cloud_id field to point to staging-specific mock APIs, while a production profile points to production mock APIs. This allows the same local configuration structure to sync with environment-appropriate cloud instances.
For example:
--profile staging targets the staging cloud API while preserving all other configuration.