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

plugins:
  - ./vendor/bref/bref
  - ./vendor/bref/extra-php-extensions

# Exclude files from deployment
package:
  exclude:
    - 'node_modules/**'
    - 'tests/**'
    - '.env.local'
functions:
  api:
    name: 'ecommerce-service-v2'
    environment:
      APP_ENV: 'prod'
      GIT: 'b879c26a30c368f2f6833eab12d75989f6d5bbb8'
      DATABASE_URL: '${ssm:/ecommerce-service-v2/prod/db_dsn_v2}'
      INSTANCE_SERVICE: '${ssm:/services/prod/instance}'
      MERCHANT_SERVICE: '${ssm:/services/prod/merchant}'
      TERMINAL_SERVICE: '${ssm:/services/prod/terminal}'
      TRANSACTION_SERVICE: '${ssm:/services/prod/transaction_v2}'
      THREE_DOMAIN_SERVICE: '${ssm:/services/prod/3d_v2}'
      CARD_SERVICE: '${ssm:/services/prod/card_v2}'
      GATEWAY_SERVICE: 'https://gateway.payoo.dev'
      NEW_GATEWAY_SERVICE: '${ssm:/services/prod/gateway-v2}'
      AWS_KMS_KEY: '${ssm:/ecommerce-service-v2/prod/kms_key}'
      AWS_TOP_UP_SIGNATURE_KEY: '${ssm:/services/prod/top-up-signature-key-kms}'
      BIN_SERVICE: 'https://s8qvvksnxi.execute-api.eu-central-1.amazonaws.com/prod/check'
      SIGN_TOP_UP: 1
      AWS_KEY: '${ssm:/ecommerce-service-v2/prod/aws_key}'
      AWS_SECRET: '${ssm:/ecommerce-service-v2/prod/aws_secret}'
      PAYMENT_PAGE_URL: 'https://page.paynetics.net'
      INTERNAL_PASSWORD: '${ssm:/ecommerce-service-v2/prod/internal_password}'
      ENCRYPTION: 1
      MESSENGER_TRANSPORT_DSN: '${ssm:/rabbitmq}'
      PAYOO: '${ssm:/services/prod/payoo_url}'
      PAYOO_PASSWORD: '${ssm:/services/prod/payoo_password}'
      BPC_INTEGRATION_SERVICE: '${ssm:/services/prod/bpc}'
      # Services URI
    handler: public/index.php
    description: 'Ecommerce Service V2'
    timeout: 30
    layers:
      - ${bref:layer.php-80-fpm}
      - ${bref-extra:amqp-php-80}
    events:
      - alb:
          listenerArn: '${ssm:/ecommerce-service-v2/prod/alb}'
          priority: 1
          multiValueHeaders: true
          conditions:
            path: /
      - schedule:
          rate: rate(5 minutes)
          input:
            warmer: true
    vpc:
      securityGroupIds:
        - '${ssm:/ecommerce-service-v2/prod/sg}'
      subnetIds:
        - '${ssm:/ecommerce-service-v2/prod/subnet}'
        - '${ssm:/ecommerce-service-v2/prod/subnet_1}'

