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"); /
7
7
const DB_PORT = process . env . POSTGRES_PORT || 5432 ;
8
8
const DB_NAME = process . env . POSTGRES_DATABASE || "postgres" ;
9
9
const DB_SCHEMA = process . env . POSTGRES_SCHEMA || "app" ;
10
+ const DB_POOL_SIZE = parseInt ( process . env . POSTGRES_POOL_SIZE || "5" , 10 ) ;
10
11
// SSL settings for PostgreSQL 17+ which requires SSL by default
11
12
const 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 } ` ;
13
14
14
15
@Injectable ( { scope : Scope . DEFAULT } )
15
16
class 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" {
200
200
name = " POSTGRES_SCHEMA"
201
201
value = " ${ var . db_schema } "
202
202
},
203
+ {
204
+ name = " POSTGRES_POOL_SIZE"
205
+ value = " ${ var . postgres_pool_size } "
206
+ },
203
207
{
204
208
name = " PORT"
205
209
value = " 3000"
Original file line number Diff line number Diff line change @@ -168,4 +168,9 @@ variable "is_public_api" {
168
168
description = " Flag to indicate if the API is public or private"
169
169
type = bool
170
170
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"
171
176
}
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ variable "app_env" {
38
38
variable "min_capacity" {
39
39
description = " Minimum capacity for Aurora Serverless v2"
40
40
type = number
41
- default = 0.5
41
+ default = 0
42
42
}
43
43
44
44
variable "max_capacity" {
You can’t perform that action at this time.
0 commit comments