Created
March 24, 2023 17:41
-
-
Save leegilmorecode/2c98de971479c436840bf0cf9491c95e to your computer and use it in GitHub Desktop.
Runtime configuration created for a ReactJS frontend and hosted in S3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup Bucket Deployment to automatically deploy new assets and invalidate cache | |
new s3deploy.BucketDeployment(this, 'ClientBucketDeployment', { | |
sources: [ | |
s3deploy.Source.asset(path.join(__dirname, '../../../../client/build')), | |
s3deploy.Source.jsonData('config.json', { | |
stage, | |
domainName: props.domainName, | |
subDomain, | |
api: `https://api-${stage}.${props.domainName}`, | |
}), // runtime config for client | |
], | |
destinationBucket: this.bucket, | |
metadata: { | |
stageName: stage, | |
}, | |
distribution: cloudFrontDistribution, | |
distributionPaths: ['/*'], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment