Skip to content

Commit

Permalink
Merge pull request #1067 from aligent/feature/graphql-mesh-server
Browse files Browse the repository at this point in the history
Use tokens for Attribute references
  • Loading branch information
AdamJHall authored Sep 1, 2023
2 parents 318a713 + a50be4e commit eea05b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/graphql-mesh-server/lib/fargate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Construct } from 'constructs';
import { Duration } from 'aws-cdk-lib';
import { Duration, Token } from 'aws-cdk-lib';
import { RemovalPolicy } from 'aws-cdk-lib';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as ecs from 'aws-cdk-lib/aws-ecs';
Expand Down Expand Up @@ -129,11 +129,11 @@ export class MeshService extends Construct {
if (props.redis) {
props.redis.securityGroup.addIngressRule(
securityGroup,
Port.tcp(Number(props.redis.connectionPort))
Port.tcp(props.redis.connectionPort)
);

environment['REDIS_ENDPOINT'] = props.redis.connectionEndPoint;
environment['REDIS_PORT'] = props.redis.connectionPort;
environment['REDIS_PORT'] = props.redis.connectionPort.toString();
}

// Construct secrets from provided ssm values
Expand Down
12 changes: 4 additions & 8 deletions packages/graphql-mesh-server/lib/redis-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
CfnSubnetGroup,
CfnParameterGroup,
} from 'aws-cdk-lib/aws-elasticache';
import { CfnOutput } from 'aws-cdk-lib';
import { CfnOutput, Reference, Token } from 'aws-cdk-lib';
import { Construct } from 'constructs';

export interface RedisServiceProps {
Expand Down Expand Up @@ -83,14 +83,10 @@ export class RedisService extends Construct {
}

public get connectionEndPoint(): string {
return this.cacheCluster
.getAtt('RedisEndpoint.Address')
.toString();
return Token.asString(this.cacheCluster.getAtt('RedisEndpoint.Address'))
}

public get connectionPort(): string {
return this.cacheCluster
.getAtt('RedisEndpoint.Port')
.toString();
public get connectionPort(): number {
return Token.asNumber(this.cacheCluster.getAtt('RedisEndpoint.Port'));
}
}

0 comments on commit eea05b0

Please sign in to comment.