service: bpc-integration-service
provider:
  name: aws
  region: eu-central-1
  runtime: provided.al2
  stage: prod

plugins:
  - ./vendor/bref/bref

# Exclude files from deployment
package:
  exclude:
    - 'node_modules/**'
    - 'tests/**'
    - '.env.local'
functions:
  api:
    name: 'bpc-integration-service'
    environment:
      APP_ENV: 'prod'
      GIT: '2fdee05692fbe491c6d17e72646f376b5145936f'
      DATABASE_URL: '${ssm:/bpc-integration-service/prod/db_dsn}'
      # Services URI
    handler: public/index.php
    description: 'Gateway Service'
    timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
    layers:
      - ${bref:layer.php-80-fpm}
    events:
      - alb:
          listenerArn: '${ssm:/bpc-integration-service/prod/alb}'
          priority: 1
          multiValueHeaders: true
          conditions:
            path: /
      - schedule:
          rate: rate(5 minutes)
          input:
            warmer: true
    vpc:
      securityGroupIds:
        - '${ssm:/bpc-integration-service/prod/sg}'
      subnetIds:
        - '${ssm:/bpc-integration-service/prod/subnet}'
