Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #66 from aligent/feature/behaviour-ordering
Browse files Browse the repository at this point in the history
Feature/behaviour ordering
  • Loading branch information
John Smith authored Oct 12, 2021
2 parents 6c81971 + 8692266 commit 4d40a41
Show file tree
Hide file tree
Showing 3 changed files with 841 additions and 258 deletions.
13 changes: 12 additions & 1 deletion lib/static-hosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export interface StaticHostingProps {
* Used to add Custom origins and behaviors
*/
customOriginConfigs?: Array<SourceConfiguration>;
/**
* Used to prepend the behaviours introduced as part of customOriginConfigs.
* This is a work around until this construct is updated to use the new
* Distribution API.
* https://docs.aws.amazon.com/cdk/api/latest/docs/aws-cloudfront-readme.html#distribution-api
*/
prependCustomOriginBehaviours?: boolean;

/**
* Optional set of behaviors to override the default behvior defined in this construct
Expand Down Expand Up @@ -123,7 +130,11 @@ export class StaticHosting extends Construct {

// Add any custom origins passed to the construct
if (props.customOriginConfigs) {
originConfigs = originConfigs.concat(props.customOriginConfigs);
if (props.prependCustomOriginBehaviours) {
originConfigs = props.customOriginConfigs.concat(originConfigs);
} else {
originConfigs = originConfigs.concat(props.customOriginConfigs);
}
}


Expand Down
Loading

0 comments on commit 4d40a41

Please sign in to comment.