service: gateway-service-test
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: 'gateway-service-test'
    environment:
      APP_ENV: 'prod'
      GIT: '3ac1e4de8095c66568bd8bdea4e9f59ec6c7eacd'
      REDIS_DSN: '${ssm:/services/prod/redis}'
      ELASTICSEARCH_HOST: '${ssm:/services/prod/elastic}'
      DATABASE_URL: '${ssm:/gateway-service/prod/db_dsn}'
      ATOS_URL: '${ssm:/gateway-service/prod/atos_url}'
      GICC_HOST: '${ssm:/gateway-service/prod/gicc_host}'
      GICC_PORT: '${ssm:/gateway-service/prod/gicc_port}'
      GICC_OPERATOR_ID: '${ssm:/gateway-service/prod/gicc_operator_id}'
      GICC_MASTER_KEY_VERSION: '${ssm:/gateway-service/prod/gicc_master_key_version}'
      GICC_MASTER_KEY: 'gicc-master-key-prod'
      AWS_KEY: '${ssm:/gateway-service/prod/aws_key}'
      AWS_SECRET: '${ssm:/gateway-service/prod/aws_secret}'
      # 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-81-fpm}
    events:
      - alb:
          listenerArn: 'arn:aws:elasticloadbalancing:eu-central-1:929138033643:listener/app/gateway-service-v2-lambda-elb/05816eaf1689ba82/14f2c3d75bb098d9'
          priority: 1
          multiValueHeaders: true
          conditions:
            path: /
      - schedule:
          rate: rate(5 minutes)
          input:
            warmer: true
    vpc:
      securityGroupIds:
        - '${ssm:/gateway-service/prod/sg}'
      subnetIds:
        - '${ssm:/gateway-service/prod/subnet}'
