frameworkVersion: "3"
custom:
  secrets: ${file(secret.json)}
  serverless-offline:
    httpPort: 3009
    lambdaPort:
    host: 127.0.0.1

  # Create Custom Domain
  customDomain:
    domainName: ${self:custom.secrets.DOMAIN}
    basePath: ${self:custom.secrets.DOMAIN_PREFIX}
    stage: ${self:custom.secrets.STAGE}
    createRoute53Record: true

service: ${self:custom.secrets.SERVICE}

provider:
  name: aws
  runtime: nodejs16.x
  stage: ${self:custom.secrets.NODE_ENV}
  timeout: 30 # optional, in seconds, default is 6
  region: me-central-1
  layers:
    - arn:aws:lambda:me-central-1:642627578700:layer:feedModule:1

functions:
  app:
    handler: app.server # reference the file and exported method
    events: # events trigger lambda functions
      - http: # this is an API Gateway HTTP event trigger
          path: /
          method: ANY
          cors:
            origin: "*"
            headers:
              - Content-Type
              - Authorization
              - language

      - http: # all routes get proxied to the Express router
          path: /{proxy+}
          method: ANY
          cors:
            origin: "*"
            headers:
              - Content-Type
              - Authorization
              - language

plugins:
  - serverless-offline
  - serverless-domain-manager

package:
  exclude:
    - venv/**
    - .git/**
    - node_modules/**
    - .serverless/**
