constructor()

in changelogs-md.js [400:479]


  constructor(parent, id, props) {
    super(parent, id, props);

    this.dist = new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', {
      aliasConfiguration: settings.domain,
      originConfigs: [
        // All the static files, like CSS, JS, images, etc
        {
          customOriginSource: {
            domainName: props.staticBucket.bucketName + '.s3-website.' + this.region + '.amazonaws.com',
            originProtocolPolicy: 'http-only'
          },
          behaviors: [
            {
              isDefaultBehavior: true,
              compress: true
            }
          ]
        },
        // The automatically generated HTML files
        {
          customOriginSource: {
            domainName: props.webBucket.bucketName + '.s3-website.' + this.region + '.amazonaws.com',
            originProtocolPolicy: 'http-only'
          },
          behaviors: [
            {
              pathPattern: 'github*',
              compress: true
            },
            {
              pathPattern: 'index.html',
              compress: true
            }
          ]
        },
        // The automatically generated JSON files
        {
          customOriginSource: {
            domainName: props.apiBucket.bucketName + '.s3-website.' + this.region + '.amazonaws.com',
            originProtocolPolicy: 'http-only'
          },
          behaviors: [
            {
              pathPattern: 'api*',
              compress: true
            }
          ]
        },
        // The autocomplete endpoints behind API gateway
        {
          customOriginSource: {
            domainName: props.autocompleteGateway.restApiId + '.execute-api.' + this.region + '.amazonaws.com',
          },
          originPath: '/prod',
          behaviors: [
            {
              pathPattern: 'search*',
              compress: true,
              forwardedValues: { queryString: true, cookies: { forward: 'none' } }
            }
          ]
        },
        // The websocket service which provides live updates to
        // the front facing website
        {
          customOriginSource: {
            domainName: props.broadcast.dnsName,
            originProtocolPolicy: 'http-only'
          },
          behaviors: [
            {
              pathPattern: 'socket.io*',
              forwardedValues: { queryString: true, cookies: { forward: 'all' } }
            }
          ]
        }
      ]
    });
  }