Ctrl K
ComunidadGuías…

src/token-retriever-function.ts

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
// ~~ Generated by projen. To modify, edit .projenrc.js and run "pnpm exec projen".
import * as path from 'path';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import { determineLatestNodeRuntime } from 'aws-cdk-lib/aws-lambda';
import { Construct } from 'constructs';

/**
 * Props for TokenRetrieverFunction
 */
export interface TokenRetrieverFunctionProps extends lambda.FunctionOptions {
  /**
   * The Lambda runtime to use.
   * @default - Latest Node.js runtime available in the deployment region
   */
  readonly runtime?: lambda.Runtime;
}

/**
 * An AWS Lambda function which executes src/token-retriever.
 */
export class TokenRetrieverFunction extends lambda.Function {
  constructor(scope: Construct, id: string, props?: TokenRetrieverFunctionProps) {
    super(scope, id, {
      description: 'src/token-retriever.lambda.ts',
      ...props,
      runtime: props?.runtime ?? determineLatestNodeRuntime(scope),
      handler: 'index.handler',
      code: lambda.Code.fromAsset(path.join(__dirname, '../assets/token-retriever.lambda')),
    });
    this.addEnvironment('AWS_NODEJS_CONNECTION_REUSE_ENABLED', '1', { removeInEdge: true });
  }
}