Skip to content

Commit 7694294

Browse files
authored
Merge pull request #57 from Azure/copilot/fix-56
Replace hardcoded PostgreSQL password with secure user prompts
2 parents e102bab + 314d76a commit 7694294

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,8 @@ nb-configuration.xml
4949
create.sql
5050
drop.sql
5151

52+
# Environment files that may contain secrets
53+
.env
54+
.env.*
55+
5256
*.dylib

scripts/infra/azure.cmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ set "REGISTRY=crjavaruntimes${UNIQUE_IDENTIFIER}"
1313
set "IMAGES_TAG=1.0"
1414

1515
set "POSTGRES_DB_ADMIN=javaruntimesadmin"
16-
set "POSTGRES_DB_PWD=java-runtimes-p#ssw0rd-12046"
16+
17+
REM Prompt for PostgreSQL password if not already set
18+
if not defined POSTGRES_DB_PWD (
19+
echo Please enter the PostgreSQL database password:
20+
set /p "POSTGRES_DB_PWD="
21+
)
1722
set "POSTGRES_DB_VERSION=14"
1823
set "POSTGRES_SKU=Standard_B1ms"
1924
set "POSTGRES_TIER=Burstable"

scripts/infra/azure.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ createInfrastructure() {
114114
IMAGES_TAG="1.0"
115115

116116
POSTGRES_DB_ADMIN="javaruntimesadmin"
117-
POSTGRES_DB_PWD="java-runtimes-p#ssw0rd-12046"
117+
118+
# Prompt for PostgreSQL password if not already set
119+
if [ -z "$POSTGRES_DB_PWD" ]; then
120+
echo "Please enter the PostgreSQL database password:"
121+
read -s POSTGRES_DB_PWD
122+
echo # Print a new line after the hidden input
123+
fi
118124
POSTGRES_DB_VERSION="14"
119125
POSTGRES_SKU="Standard_B1ms"
120126
POSTGRES_TIER="Burstable"

scripts/infra/env.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ export REGISTRY="crjavaruntimes${UNIQUE_IDENTIFIER}"
2626
export IMAGES_TAG="1.0"
2727

2828
export POSTGRES_DB_ADMIN="javaruntimesadmin"
29-
export POSTGRES_DB_PWD="java-runtimes-p#ssw0rd-12046"
29+
30+
# Prompt for PostgreSQL password if not already set
31+
if [ -z "$POSTGRES_DB_PWD" ]; then
32+
echo "Please enter the PostgreSQL database password:"
33+
read -s POSTGRES_DB_PWD
34+
echo # Print a new line after the hidden input
35+
fi
36+
export POSTGRES_DB_PWD
3037
export POSTGRES_DB_VERSION="14"
3138
export POSTGRES_SKU="Standard_B1ms"
3239
export POSTGRES_TIER="Burstable"

0 commit comments

Comments
 (0)