File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ const DB_PWD = encodeURIComponent(process.env.POSTGRES_PASSWORD || "default"); /
77const DB_PORT = process . env . POSTGRES_PORT || 5432 ;
88const DB_NAME = process . env . POSTGRES_DATABASE || "postgres" ;
99const DB_SCHEMA = process . env . POSTGRES_SCHEMA || "app" ;
10+ const DB_POOL_SIZE = parseInt ( process . env . POSTGRES_POOL_SIZE || "5" , 10 ) ;
1011// SSL settings for PostgreSQL 17+ which requires SSL by default
1112const SSL_MODE = ( process . env . NODE_ENV === 'local' || 'unittest' ) ? 'prefer' : 'require' ; // 'require' for aws deployments, 'prefer' for local development or ut in gha
12- const dataSourceURL = `postgresql://${ DB_USER } :${ DB_PWD } @${ DB_HOST } :${ DB_PORT } /${ DB_NAME } ?schema=${ DB_SCHEMA } &connection_limit=5 &sslmode=${ SSL_MODE } ` ;
13+ const dataSourceURL = `postgresql://${ DB_USER } :${ DB_PWD } @${ DB_HOST } :${ DB_PORT } /${ DB_NAME } ?schema=${ DB_SCHEMA } &connection_limit=${ DB_POOL_SIZE } &sslmode=${ SSL_MODE } ` ;
1314
1415@Injectable ( { scope : Scope . DEFAULT } )
1516class PrismaService extends PrismaClient < Prisma . PrismaClientOptions , 'query' > implements OnModuleInit , OnModuleDestroy {
Original file line number Diff line number Diff line change @@ -200,6 +200,10 @@ resource "aws_ecs_task_definition" "node_api_task" {
200200 name = " POSTGRES_SCHEMA"
201201 value = " ${ var . db_schema } "
202202 },
203+ {
204+ name = " POSTGRES_POOL_SIZE"
205+ value = " ${ var . postgres_pool_size } "
206+ },
203207 {
204208 name = " PORT"
205209 value = " 3000"
Original file line number Diff line number Diff line change @@ -168,4 +168,9 @@ variable "is_public_api" {
168168 description = " Flag to indicate if the API is public or private"
169169 type = bool
170170 default = true
171+ }
172+ variable "postgres_pool_size" {
173+ description = " The size of the connection pool for the API"
174+ type = string
175+ default = " 1"
171176}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ variable "app_env" {
3838variable "min_capacity" {
3939 description = " Minimum capacity for Aurora Serverless v2"
4040 type = number
41- default = 0.5
41+ default = 0
4242}
4343
4444variable "max_capacity" {
You can’t perform that action at this time.
0 commit comments