in src/constructs/autoscaling/user-data.ts [45:64]
private downloadConfiguration(scope: GuStack, app: string, props: GuPrivateS3ConfigurationProps) {
const bucket = Bucket.fromBucketAttributes(scope, `${app}ConfigurationBucket`, {
bucketName: props.bucket.valueAsString,
});
props.files.forEach((bucketKey) => {
const fileName = bucketKey.split("/").slice(-1)[0];
// `fileName` is typed as `string | undefined`. Throw if `fileName` is falsy.
if (!fileName) {
throw new Error("Failed to create configuration section in UserData");
}
this.addS3DownloadCommand({
bucket,
bucketKey,
localFile: `/etc/${app}/${fileName}`,
});
});
}