frameworkVersion: "3"
custom:
  secrets: ${file(config/config.json)}
  serverless-offline:
    httpPort: 3020
    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: nodejs20.x
  stage: ${self:custom.secrets.NODE_ENV}
  timeout: 30 # optional, in seconds, default is 6
  region: us-west-1
  layers:
    - arn:aws:lambda:us-west-1:257394459219:layer:aws-service:2

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

  # challenge-remember-mail-cron:
  #   handler: controllers/v1/cron/cronController.challengeRememberMail
    # events:
    #    - schedule:
    #        rate: cron(*/1 * * * ? *) 
    #        enabled: true               

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

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