File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
infrastructure/modules/container-apps
manage_breast_screening/config Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -97,5 +97,7 @@ module "database_container" {
9797 infra_key_vault_name = " kv-${ var . app_short_name } -${ var . env_config } -inf"
9898 infra_key_vault_rg = " rg-${ var . app_short_name } -${ var . env_config } -infra"
9999 is_tcp_app = true
100- port = 5432
100+ # postgres has a port of 5432
101+ port = 5432
102+ exposed_port = local. database_port
101103}
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ locals {
136136
137137 database_user = " admin"
138138 database_name = " manage_breast_screening"
139+ # Here we expect the environment to be in format pr-XXX. For example PR 1234 would have environment pr-1234 and port 2234
140+ database_port = var. deploy_database_as_container ? tonumber (regex (" \\ d+" , var. environment )) + 1000 : 5432
139141
140142 common_env = {
141143 SSL_MODE = " require"
@@ -147,6 +149,7 @@ locals {
147149 DATABASE_HOST = var.deploy_database_as_container ? module.database_container[0 ].container_app_fqdn : null
148150 DATABASE_NAME = local.database_name
149151 DATABASE_USER = local.database_user
152+ DATABASE_PORT = local.database_port
150153 }
151154
152155 azure_db_env = {
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ def boolean_env(key, default=None):
147147 "USER" : environ .get ("DATABASE_USER" , "" ),
148148 "PASSWORD" : environ .get ("DATABASE_PASSWORD" , "" ),
149149 "HOST" : environ .get ("DATABASE_HOST" , "" ),
150- "PORT" : " 5432" ,
150+ "PORT" : environ . get ( "DATABASE_PORT" , " 5432") ,
151151 "OPTIONS" : {"sslmode" : environ .get ("DATABASE_SSLMODE" , "prefer" )},
152152 }
153153}
You can’t perform that action at this time.
0 commit comments