-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgadmin-entrypoint.sh
55 lines (48 loc) · 1.07 KB
/
pgadmin-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Wait for PostgreSQL to be ready
until pg_isready -h postgres -U ${PG_DATABASE_PROD_USER}; do
echo "Waiting for PostgreSQL..."
sleep 2
done
# Create a server definition file
cat > /pgadmin4/servers.json <<EOF
{
"Servers": {
"1": {
"Name": "PostgreSQL",
"Group": "Servers",
"Host": "postgres",
"Port": 5436,
"MaintenanceDB": "postgres",
"Username": "${PG_DATABASE_PROD_USER}",
"Password": "${PG_DATABASE_PROD_PASSWORD}",
"SSLMode": "prefer"
}
}
}
EOF
#!/bin/bash
# Wait for PostgreSQL to be ready
until pg_isready -h postgres -U ${PG_DATABASE_PROD_USER}; do
echo "Waiting for PostgreSQL..."
sleep 2
done
# Create a server definition file
cat > /pgadmin4/servers.json <<EOF
{
"Servers": {
"1": {
"Name": "PostgreSQL",
"Group": "Servers",
"Host": "postgres",
"Port": 5432,
"MaintenanceDB": "postgres",
"Username": "${PG_DATABASE_PROD_USER}",
"Password": "${PG_DATABASE_PROD_PASSWORD}",
"SSLMode": "prefer"
}
}
}
EOF
## Start pgAdmin
#/entrypoint.sh