133 lines
3.6 KiB
YAML
133 lines
3.6 KiB
YAML
service: minglar
|
|
|
|
provider:
|
|
name: aws
|
|
runtime: nodejs22.x
|
|
region: ap-south-1
|
|
versionFunctions: false
|
|
memorySize: 512
|
|
# Apply Prisma layer to all functions
|
|
# Reference the layer defined in this stack using CloudFormation Ref
|
|
layers:
|
|
- !Ref PrismaLambdaLayer
|
|
apiGateway:
|
|
binaryMediaTypes:
|
|
- '*/*'
|
|
minimumCompressionSize: 1024
|
|
|
|
environment:
|
|
DATABASE_URL: ${env:DATABASE_URL}
|
|
DB_USERNAME: ${env:DB_USERNAME}
|
|
DB_PASSWORD: ${env:DB_PASSWORD}
|
|
DB_DATABASE_NAME: ${env:DB_DATABASE_NAME}
|
|
DB_HOSTNAME: ${env:DB_HOSTNAME}
|
|
DB_PORT: ${env:DB_PORT}
|
|
BY_PASS_EMAIL: ${env:BY_PASS_EMAIL}
|
|
BYPASS_OTP: ${env:BYPASS_OTP}
|
|
BREVO_EMAIL_API_KEY: ${env:BREVO_EMAIL_API_KEY}
|
|
BREVO_API_BASEURL: ${env:BREVO_API_BASEURL}
|
|
BREVO_FROM_EMAIL: ${env:BREVO_FROM_EMAIL}
|
|
BREVO_SMTP_HOST: ${env:BREVO_SMTP_HOST}
|
|
BREVO_SMTP_PORT: ${env:BREVO_SMTP_PORT}
|
|
BREVO_SMTP_USER: ${env:BREVO_SMTP_USER}
|
|
BREVO_SMTP_PASS: ${env:BREVO_SMTP_PASS}
|
|
REFRESH_TOKEN_SECRET: ${env:REFRESH_TOKEN_SECRET}
|
|
JWT_SECRET: ${env:JWT_SECRET}
|
|
JWT_ACCESS_EXPIRATION_MINUTES: ${env:JWT_ACCESS_EXPIRATION_MINUTES}
|
|
JWT_REFRESH_EXPIRATION_DAYS: ${env:JWT_REFRESH_EXPIRATION_DAYS}
|
|
JWT_RESET_PASSWORD_EXPIRATION_MINUTES: ${env:JWT_RESET_PASSWORD_EXPIRATION_MINUTES}
|
|
JWT_VERIFY_EMAIL_EXPIRATION_MINUTES: ${env:JWT_VERIFY_EMAIL_EXPIRATION_MINUTES}
|
|
SALT_ROUNDS: ${env:SALT_ROUNDS}
|
|
NODE_ENV: ${env:NODE_ENV}
|
|
S3_BUCKET_NAME: ${env:S3_BUCKET_NAME}
|
|
MINGLAR_ADMIN_NAME: ${env:MINGLAR_ADMIN_NAME}
|
|
MINGLAR_ADMIN_EMAIL: ${env:MINGLAR_ADMIN_EMAIL}
|
|
AM_INVITATION_LINK: ${env:AM_INVITATION_LINK}
|
|
|
|
iam:
|
|
role:
|
|
statements:
|
|
- Effect: Allow
|
|
Action:
|
|
- s3:PutObject
|
|
- s3:GetObject
|
|
- s3:DeleteObject
|
|
- s3:ListBucket
|
|
Resource:
|
|
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}'
|
|
- 'arn:aws:s3:::${env:S3_BUCKET_NAME}/*'
|
|
|
|
custom:
|
|
serverless-offline:
|
|
reloadHandler: true
|
|
|
|
build:
|
|
esbuild:
|
|
bundle: true
|
|
minify: true
|
|
sourcemap: false
|
|
target: node20
|
|
platform: node
|
|
# Mark as external so they're not bundled into the JS
|
|
external:
|
|
- '@prisma/client'
|
|
- '@prisma/adapter-pg'
|
|
- '.prisma/client'
|
|
- '.prisma'
|
|
- 'pg'
|
|
- '@aws-sdk/*'
|
|
- '@smithy/*'
|
|
- '@aws-crypto/*'
|
|
# Exclude prevents npm install of these packages in the zip
|
|
exclude:
|
|
- 'aws-sdk'
|
|
- '@aws-sdk/*'
|
|
- '@smithy/*'
|
|
- '@aws-crypto/*'
|
|
- '@prisma/client'
|
|
- '@prisma/adapter-pg'
|
|
- '.prisma'
|
|
- '.prisma/client'
|
|
- 'pg'
|
|
- 'pg-*'
|
|
- 'postgres-*'
|
|
- 'pgpass'
|
|
- 'split2'
|
|
- 'xtend'
|
|
|
|
# Define layers
|
|
layers:
|
|
prisma:
|
|
path: layers/prisma
|
|
name: ${self:service}-prisma-layer-${sls:stage}
|
|
description: Prisma 7 client with pg driver adapter (no binary engines)
|
|
compatibleRuntimes:
|
|
- nodejs22.x
|
|
retain: false
|
|
|
|
package:
|
|
individually: true
|
|
patterns:
|
|
- '!node_modules/**'
|
|
- '!node_modules/@prisma/**'
|
|
- '!node_modules/.prisma/**'
|
|
- '!**/*.test.js'
|
|
- '!**/*.spec.js'
|
|
- '!**/test/**'
|
|
- '!**/__tests__/**'
|
|
- '!package-lock.json'
|
|
- '!yarn.lock'
|
|
- '!README.md'
|
|
- '!*.config.js'
|
|
- '!.git/**'
|
|
- '!.github/**'
|
|
|
|
# Import function definitions from separate files organized by module
|
|
functions:
|
|
- ${file(./serverless/functions/host.yml)}
|
|
- ${file(./serverless/functions/minglaradmin.yml)}
|
|
- ${file(./serverless/functions/prepopulate.yml)}
|
|
- ${file(./serverless/functions/pqq.yml)}
|
|
|
|
plugins:
|
|
- serverless-offline |