# 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: social-content
# 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: 3008
    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:xxxxxxxxxxxxx:layer:socialService:4

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/**
