service: apollo-playlist-sync

frameworkVersion: '3'
useDotenv: true

plugins:
  - serverless-offline
  - serverless-python-requirements
  - serverless-offline-scheduler

custom:
  serverless-offline:
    host: 0.0.0.0
    httpPort: 8000
    lambdaPort: 8001

  pythonRequirements:
    fileName: requirements/base.pip
    pipCmdExtraArgs:
      - --extra-index-url
      - https://artifacts.apollo.stream/repository/pypi-all/simple

provider:
  name: aws
  # TODO: It should be python3.10 but serverless-offline doesn't support it
  # waiting for https://github.com/dherault/serverless-offline/pull/1685 to update serverless and serverless-offline
  # and then switch to python3.10
  runtime: python3.9
  timeout: 300

functions:
  playlists_sync:
    handler: src.lambda_handler
    timeout: 300
    events:
      - http:
          path: /{proxy+}
          method: ANY
          cors: true
#      - schedule:
#          name: playlist-sync
#          description: 'Synchronize playlists once a day'
#          rate: cron(0 0 * * ? *)
