Skip to content

Commit

Permalink
HOTFIX: Allow multiple stacks to be deployed to the same acocunt with…
Browse files Browse the repository at this point in the history
… safer defaults

Only create auth table if name is passed
Add prop to pass dashboard name
Set default dashboard name to include the stack name so that a second stack with no prop set won't cause a failed deployment
  • Loading branch information
AdamJHall committed Jul 16, 2024
1 parent 234c0bf commit 82eb083
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/graphql-mesh-server/lib/fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ export interface MeshServiceProps {
*/
logStreamPrefix?: string;
/**
* Whether a DynamoDB table should be created to store session data
* @default authentication-table
* Whether a DynamoDB table should be created to store session data,
* if not defined a table will not be created.
* @default undefined
*/
authenticationTable?: string;

Expand Down Expand Up @@ -348,7 +349,7 @@ export class MeshService extends Construct {
managedPolicyArn: "arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess",
});

if (props.authenticationTable || props.authenticationTable === undefined) {
if (props.authenticationTable) {
const authTable = new dynamodb.Table(this, "authenticationTable", {
tableName: props.authenticationTable || "authentication-table",
partitionKey: {
Expand Down
3 changes: 2 additions & 1 deletion packages/graphql-mesh-server/lib/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface PerformanceMetricsProps {
logGroup: LogGroup;
snsTopic?: Topic;
additionalAlarms?: Alarm[];
dashboardName?: string;
}

export class PerformanceMetrics extends Construct {
Expand Down Expand Up @@ -355,7 +356,7 @@ export class PerformanceMetrics extends Construct {

// Create the dashboard
new Dashboard(this, "dashboard", {
dashboardName: "Mesh-Dashboard",
dashboardName: props.dashboardName ?? Stack.of(this).stackName + "-Mesh-Dashboard",
widgets: [
[new Column(...loadBalancerWidgets), new Column(...wafWidgets)],
[meshPerformanceLabel],
Expand Down

0 comments on commit 82eb083

Please sign in to comment.