Skip to main content

generateWebSubDomain(params): GenerateWebSubDomain

Defined in: src/dns/generate-web-sub-domain/generate-web-sub-domain.ts:65

Generates a web subdomain configuration based on the stage name and domain name.

This function creates stage-specific web subdomains for different deployment environments. Production uses the root domain (with 'www' as the stage identifier), while other stages use stage-prefixed subdomains for clear environment separation.

Parameters

params

GenerateWebSubDomainParams

The parameters object

Returns

GenerateWebSubDomain

An object containing both the stage identifier and the complete subdomain

Example

// Production stage - uses root domain
generateWebSubDomain({ stageName: 'prod', domainName: 'example.com' })
// Returns: `{ stage: 'www', subDomain: 'example.com' }`

// Development stage
generateWebSubDomain({ stageName: 'develop', domainName: 'example.com' })
// Returns: `{ stage: 'develop', subDomain: 'develop.example.com' }`

// Staging stage
generateWebSubDomain({ stageName: 'staging', domainName: 'example.com' })
// Returns: `{ stage: 'staging', subDomain: 'staging.example.com' }`

// Custom stage
generateWebSubDomain({ stageName: 'feature-123', domainName: 'example.com' })
// Returns: `{ stage: 'feature-123', subDomain: 'feature-123.example.com' }`

Remarks

  • Production stage ('prod') returns the root domain without prefix
  • Known stages (develop, staging) get predictable '{stage}.domain.com' format
  • Unknown/custom stages follow the same pattern as known non-production stages
  • Custom stage names are converted to lowercase for consistency
  • The stage field can be used for configuration or identification purposes

Since

1.0.0