org: eventablyapi
app: eventably-api-dev
#service: eventably-api-staging

service: eventably-api-serverless
configValidationMode: error

provider:
    name: aws
    runtime: nodejs18.x
    region: us-east-1
    vpc:
        securityGroupIds:
            - sg-0e01c6fc2fcf4f95e
        subnetIds:
            - subnet-08db3fee2ef2be87f
            - subnet-0bfdf4a75669dbecb

resources:
    Resources:
        # EFS File System
        EFSFileSystem:
            Type: AWS::EFS::FileSystem
            Properties:
                Encrypted: true
                PerformanceMode: generalPurpose

functions:
    api:
        handler: dist/handler.main
        # timeout: 15
        events:
            - http:
                  path: /{proxy+}
                  method: ANY
        fileSystemConfig:
            localMountPath: /mnt/data
            arn: arn:aws:elasticfilesystem:us-east-1:209479305220:access-point/fsap-008a754ecf40f0058

plugins:
    - serverless-plugin-typescript
    - serverless-scriptable-plugin
    - serverless-offline
    - serverless-plugin-warmup

# Custom hooks for migrations and seeders
custom:
    warmup:
    enabled: true
    folderName: '.warmup' # Set the folder for warmup files
    pathFile: false # Disable path file generation if not required
    cleanFolder: true # Clean the warmup folder on each deploy
    prewarm: true # Prewarm Lambdas on deployment
    default:
        concurrency: 5
    # scriptHooks:
    #     after:deploy:deploy: 'npm run db-setup'

# scripts:
#   hooks:
#     after:deploy:finalize: "npm run db-setup"

package:
    individually: true
    exclude:
        - node_modules/**
    include:
        - .env
#custom:
#  scriptable:
#    hooks:
#      after:deploy:finalize:
#        - ./scripts/upload-to-efs.sh  # Upload node_modules to EFS currently not in use
