Skip to content

Commit

Permalink
feat: Support passing AssetOptions
Browse files Browse the repository at this point in the history
fixes #7098
  • Loading branch information
christophgysin committed Mar 31, 2020
1 parent abc2144 commit 1f9437d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/@aws-cdk/aws-s3-deployment/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ export class Source {
* Uses a local asset as the deployment source.
* @param path The path to a local .zip file or a directory
*/
public static asset(path: string): ISource {
public static asset(path: string, options?: s3_assets.AssetOptions): ISource {
return {
bind(context: cdk.Construct): SourceConfig {
let id = 1;
while (context.node.tryFindChild(`Asset${id}`)) {
id++;
}
const asset = new s3_assets.Asset(context, `Asset${id}`, { path });
const asset = new s3_assets.Asset(context, `Asset${id}`, {
path,
...options,
});
if (!asset.isZipArchive) {
throw new Error(`Asset path must be either a .zip file or a directory`);
}
Expand Down

0 comments on commit 1f9437d

Please sign in to comment.