cedar-aws.ts800 BView on GitHub
import { App } from 'aws-cdk-lib';
import { CedarAwsStack } from '../lib/cedar-aws-stack.js';
import type { CedarAwsDeploymentMode, CedarAwsEnvironmentName } from '../lib/config.js';

const app = new App();
const requestedEnvironment = process.env.CEDAR_AWS_ENV as
  | CedarAwsEnvironmentName
  | 'all'
  | undefined;
const requestedMode = process.env.CEDAR_AWS_MODE as CedarAwsDeploymentMode | undefined;

const environments =
  requestedEnvironment === 'all' || requestedEnvironment === undefined
    ? [
        { envName: 'staging' as const, deploymentMode: 'staging' as const },
        { envName: 'prod' as const, deploymentMode: 'prod' as const },
      ]
    : [{ envName: requestedEnvironment, deploymentMode: requestedMode }];

new CedarAwsStack(app, 'CedarAwsStack', {
  environments,
});