Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copy this file to .env and adjust values for local development

# AWS CDK Stage (stg or prod)
# STAGE=stg
STAGE=prod

# Mesh Secret Key (for domain validation)
MESH_SECRET_KEY=your-secret-key-here
Expand Down
4 changes: 2 additions & 2 deletions bin/mesh-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dotenv.config({ path: path.join(__dirname, '../.env'), override: true });

const app = new cdk.App();

// Stage取得(デフォルト: stg)
const stage = app.node.tryGetContext('stage') || 'stg';
// Stage取得(優先順位: --context stage=..., .envのSTAGE, デフォルト: stg)
const stage = app.node.tryGetContext('stage') || process.env.STAGE || 'stg';
const stackName = stage === 'prod' ? 'MeshV2Stack' : `MeshV2Stack-${stage}`;

new MeshV2Stack(app, stackName, {
Expand Down
1 change: 0 additions & 1 deletion cdk.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
]
},
"context": {
"stage": "stg",
"@aws-cdk/aws-signer:signingProfileNamePassedToCfn": true,
"@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": true,
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
Expand Down
4 changes: 2 additions & 2 deletions lib/mesh-v2-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export class MeshV2Stack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

// Stage取得(デフォルト: stg)
const stage = this.node.tryGetContext('stage') || 'stg';
// Stage取得(優先順位: --context stage=..., .envのSTAGE, デフォルト: stg)
const stage = this.node.tryGetContext('stage') || process.env.STAGE || 'stg';
const stageSuffix = stage === 'prod' ? '' : `-${stage}`;

// Stack全体にタグ付与
Expand Down
Loading