# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
#    docs.serverless.com
#
# Happy Coding!

service: user-services
# app and org for use with dashboard.serverless.com
#app: your-app-name
#org: your-org-name

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
frameworkVersion: "3"
custom:
  secrets: ${file(secret.json)}
  serverless-offline:
    httpPort: 3001
    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

provider:
  name: aws
  runtime: nodejs16.x
  stage: ${self:custom.secrets.NODE_ENV}
  timeout: 30 # optional, in seconds, default is 6
  region: us-east-1
  layers:
     - arn:aws:lambda:us-east-1:xxxxxxxxxxxxxx:layer:userServiceLayer: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
              - Accept-Language

      - http: # all routes get proxied to the Express router
          path: /{proxy+}
          method: ANY
          cors:
            origin: "*"
            headers:
              - Content-Type
              - Authorization
              - language
  
  # serverless-upload-trigger:
    # handler: controllers/v1/trigger/uploadController.serverlessUpload
    # layers: arn:aws:lambda:me-central-1:642627578700:layer:AwsClient:1
    # events:
    #   - s3:
    #       bucket: devassets.prisonwifebesties.com
    #       event: s3:ObjectCreated:*
    #       # rules:
    #       #   - prefix: uploads/
    #       #   - suffix: .jpg
    #       existing: true

plugins:
  - serverless-offline
  - serverless-domain-manager
  # - serverless-plugin-existing-s3

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