Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let pathMetadata: boolean = config.settings.get(['pathMetadata']);
if (pathMetadata === undefined) {
pathMetadata = true; // defaults to true
}
if (pathMetadata) {
context[cxapi.PATH_METADATA_ENABLE_CONTEXT] = true;
}
let assetMetadata: boolean = config.settings.get(['assetMetadata']);
if (assetMetadata === undefined) {
assetMetadata = true; // defaults to true
}
if (assetMetadata) {
context[cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT] = true;
}
let versionReporting: boolean = config.settings.get(['versionReporting']);
if (versionReporting === undefined) {
versionReporting = true; // defaults to true
}
if (!versionReporting) {
context[cxapi.DISABLE_VERSION_REPORTING] = true;
}
let stagingEnabled = config.settings.get(['staging']);
if (stagingEnabled === undefined) {
stagingEnabled = true;
}
if (!stagingEnabled) {
public addResourceMetadata(resource: cdk.CfnResource, resourceProperty: string) {
if (!this.node.tryGetContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) {
return; // not enabled
}
// tell tools such as SAM CLI that the "Code" property of this resource
// points to a local path in order to enable local invocation of this function.
resource.cfnOptions.metadata = resource.cfnOptions.metadata || { };
resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PATH_KEY] = this.assetPath;
resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PROPERTY_KEY] = resourceProperty;
}