# serverless.yml
service:
  name: cloudworker-proxy

provider:
  name: cloudflare
  environment:
  config:
    accountId: ${env:CLOUDFLARE_ACCOUNT_ID}
    zoneId: ${env:CLOUDFLARE_ZONE_ID}

plugins:
  - serverless-dotenv-plugin
  - serverless-scriptable-plugin
  - serverless-cloudflare-workers

custom:
  scriptHooks:
    package:createDeploymentArtifacts: npm run build
  dotenv:
    path: ../.env

functions:
  cloudworker-proxy-examples:
    # What the script will be called on Cloudflare (this property value must match the function name one line above)
    name: cloudworker-proxy-examples
    # The name of the script on your machine, omitting the .js file extension
    script: 'dist/bundle'
    webpack: false
    resources:
      kv:
        - variable: TEST_NAMESPACE
          namespace: test
    events:
      - http:
          url: 'proxy.cloudproxy.io/*'
          method: ANY
