Skip to content

Commit 70ed4c3

Browse files
committed
style(database): database name convention over configuration
1 parent f5dbc1e commit 70ed4c3

3 files changed

Lines changed: 6 additions & 20 deletions

File tree

charts/database/templates/database-secret-creds.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ metadata:
1111
data:
1212
user: {{ if .Values.username | default "" | ne "" }}{{ .Values.username | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
1313
password: {{ if .Values.password | default "" | ne "" }}{{ .Values.password | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
14-
controller-database-name: {{ if .Values.controllerDatabaseName | default "" | ne "" }}{{ .Values.controllerDatabaseName | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
15-
passport-database-name: {{ if .Values.passportDatabaseName | default "" | ne "" }}{{ .Values.passportDatabaseName | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
1614
{{- end }}

contrib/ci/test.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ create-postgres-creds() {
2222
mkdir -p "${CURRENT_DIR}"/tmp/creds
2323
echo "testuser" > "${CURRENT_DIR}"/tmp/creds/user
2424
echo "icanttellyou" > "${CURRENT_DIR}"/tmp/creds/password
25-
echo "drycc_controller" > "${CURRENT_DIR}"/tmp/creds/controller-database-name
26-
echo "drycc_passport" > "${CURRENT_DIR}"/tmp/creds/passport-database-name
2725
}
2826

2927
start-postgres() {

rootfs/docker-entrypoint.sh

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ set_listen_addresses() {
1212

1313
POSTGRES_USER="$(cat /var/run/secrets/drycc/database/creds/user)"
1414
POSTGRES_PASSWORD="$(cat /var/run/secrets/drycc/database/creds/password)"
15-
POSTGRES_CONTROLLER="$(cat /var/run/secrets/drycc/database/creds/controller-database-name)"
16-
POSTGRES_PASSPORT="$(cat /var/run/secrets/drycc/database/creds/passport-database-name)"
1715

1816
if [ "$1" = 'postgres' ]; then
1917
mkdir -p "$PGDATA"
@@ -62,20 +60,6 @@ if [ "$1" = 'postgres' ]; then
6260
: ${POSTGRES_USER:=postgres}
6361
export POSTGRES_USER
6462

65-
if [ "$POSTGRES_CONTROLLER" != '' ]; then
66-
psql --username postgres <<-EOSQL
67-
CREATE DATABASE "$POSTGRES_CONTROLLER" ;
68-
EOSQL
69-
echo
70-
fi
71-
72-
if [ "$POSTGRES_PASSPORT" != '' ]; then
73-
psql --username postgres <<-EOSQL
74-
CREATE DATABASE "$POSTGRES_PASSPORT" ;
75-
EOSQL
76-
echo
77-
fi
78-
7963
if [ "$POSTGRES_USER" = 'postgres' ]; then
8064
op='ALTER'
8165
else
@@ -87,7 +71,13 @@ if [ "$1" = 'postgres' ]; then
8771
EOSQL
8872
echo
8973

74+
# Initialize the passport and controller databases
75+
psql --username postgres <<-EOSQL
76+
CREATE DATABASE passport;
77+
CREATE DATABASE controller;
78+
EOSQL
9079
echo
80+
9181
for f in /docker-entrypoint-initdb.d/*; do
9282
case "$f" in
9383
*.sh) echo "$0: running $f"; . "$f" ;;

0 commit comments

Comments
 (0)