Skip to content

Commit

Permalink
refactor: Consistently destructure props
Browse files Browse the repository at this point in the history
  • Loading branch information
akash1810 committed Apr 9, 2021
1 parent 3f024f2 commit 1db9be7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/constructs/loadbalancing/alb/application-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export interface GuApplicationListenerProps extends ApplicationListenerProps, Ap

export class GuApplicationListener extends ApplicationListener {
constructor(scope: GuStack, id: string, props: GuApplicationListenerProps) {
const { app } = props;
const { app, overrideId } = props;

super(scope, AppIdentity.suffixText({ app }, id), { port: 443, protocol: ApplicationProtocol.HTTPS, ...props });

if (props.overrideId || (scope.migratedFromCloudFormation && props.overrideId !== false))
if (overrideId || (scope.migratedFromCloudFormation && overrideId !== false))
(this.node.defaultChild as CfnListener).overrideLogicalId(id);

/*
Expand All @@ -39,12 +39,12 @@ export interface GuHttpsApplicationListenerProps

export class GuHttpsApplicationListener extends ApplicationListener {
constructor(scope: GuStack, id: string, props: GuHttpsApplicationListenerProps) {
const { app } = props;
const { app, certificate, targetGroup } = props;

if (props.certificate) {
const isValid = new RegExp(RegexPattern.ACM_ARN).test(props.certificate);
if (certificate) {
const isValid = new RegExp(RegexPattern.ACM_ARN).test(certificate);
if (!isValid) {
throw new Error(`${props.certificate} is not a valid ACM ARN`);
throw new Error(`${certificate} is not a valid ACM ARN`);
}
}

Expand All @@ -54,10 +54,10 @@ export class GuHttpsApplicationListener extends ApplicationListener {
...props,
certificates: [
{
certificateArn: props.certificate ?? new GuCertificateArnParameter(scope, props).valueAsString,
certificateArn: certificate ?? new GuCertificateArnParameter(scope, props).valueAsString,
},
],
defaultAction: ListenerAction.forward([props.targetGroup]),
defaultAction: ListenerAction.forward([targetGroup]),
};

super(scope, AppIdentity.suffixText({ app }, id), mergedProps);
Expand Down

0 comments on commit 1db9be7

Please sign in to comment.