Files
esdp/serverless/serverless.yml
2026-02-26 12:31:24 -08:00

130 lines
4.0 KiB
YAML

service: esdp-api
app: esdp-api-app
stages:
prod:
# Enables observability in the prod stage
observability: true
# Sepcify parameter values to be used in the prod stage
params:
es_endpoint: https://insurtechtoolkit.com
domain: es.imex.online
es_user: Imex2
es_password: Patrick
hasura_url: https://es.db.imex.online/v1/graphql
beta:
# Enables observability in the prod stage
observability: false
# Sepcify parameter values to be used in the prod stage
params:
es_endpoint: https://4284-79073.el-alt.com
domain: beta.es.imex.online
es_user: Imex2
es_password: Patrick
hasura_url: https://es.db.imex.online/v1/graphql
alpha:
# Enables observability in the prod stage
observability: false
# Sepcify parameter values to be used in the prod stage
params:
es_endpoint: https://4284-79287.el-alt.com
domain: alpha.es.imex.online
es_user: Imex2
es_password: Patrick
hasura_url: https://es.db.imex.online/v1/graphql
dev:
# Enables observability in the prod stage
observability: false
# Sepcify parameter values to be used in the prod stage
params:
es_endpoint: https://4284-79287.el-alt.com
domain: dev.es.imex.online
es_user: Imex2
es_password: Patrick
hasura_url: https://es.db.imex.online/v1/graphql
# params:
# dev:
# domain: dev.es.imex.online
# alpha:
# domain: alpha.es.imex.online
# beta:
# domain: beta.es.imex.online
# prod:
# domain: es.imex.online
provider:
name: aws
runtime: nodejs22.x
region: ca-central-1
domain: ${param:domain}
httpApi: # This creates a cheaper, faster "HTTP API" Gateway
cors: true # Automatically configures CORS
build:
esbuild:
bundle: true
minify: false
sourcemap: true
exclude:
- '@aws-sdk/*'
target: node22
platform: node
functions:
vehicleType:
handler: src/handlers/vehicleType.handler
events:
- httpApi:
path: /vehicleType
method: post
scrub:
handler: src/handlers/scrub.handler
environment:
ES_ENDPOINT: ${param:es_endpoint}
ES_USER: ${param:es_user}
ES_PASSWORD: ${param:es_password}
HASURA_URL: ${param:hasura_url}
# Resolve at deploy-time from AWS Secrets Manager (value is not stored in this file).
# This secret is expected to be JSON; we pull the `admin_secret` field.
HASURA_SECRET: '{{resolve:secretsmanager:arn:aws:secretsmanager:ca-central-1:714144183158:secret:esdp-hasura-credentials-s81i1u-BDFgPi:SecretString:admin_secret::}}'
events:
- httpApi:
path: /scrub
method: post
emsupload:
handler: src/handlers/emsupload.handler
environment:
ES_ENDPOINT: ${param:es_endpoint}
UPLOAD_BUCKET_NAME: ${self:service}-uploads-${sls:stage}
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:PutObjectAcl
- s3:GetObject
Resource:
- arn:aws:s3:::${self:service}-uploads-${sls:stage}/*
events:
- httpApi:
path: /emsupload
method: post
resources:
Resources:
UploadBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:service}-uploads-${sls:stage}
CorsConfiguration:
CorsRules:
- AllowedOrigins:
- '*'
AllowedMethods:
- PUT
- POST
AllowedHeaders:
- '*'