Skip to content

Commit 696b7f9

Browse files
author
Andrew Welch
committed
Refactor to LOCAL_DB_CONTAINER
1 parent a318eaa commit 696b7f9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

scripts/docker_pull_db.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ function pull_pgsql_ssh() {
6464
copy_db_dump_locally
6565
}
6666
function restore_local_from_remote_mysql() {
67-
${DB_ZCAT_CMD} "${TMP_DB_PATH}.gz" | docker exec -i devmode_postgres_1 ${LOCAL_MYSQL_CMD} ${LOCAL_DB_CREDS}
67+
${DB_ZCAT_CMD} "${TMP_DB_PATH}.gz" | docker exec -i ${LOCAL_DB_CONTAINER} ${LOCAL_MYSQL_CMD} ${LOCAL_DB_CREDS}
6868
echo "*** Restored docker MySQL database from ${TMP_DB_PATH}.gz"
6969
}
7070
function restore_local_from_remote_pgsql() {
71-
${DB_ZCAT_CMD} "${TMP_DB_PATH}.gz" | docker exec -i devmode_postgres_1 ${LOCAL_PSQL_CMD} --output /dev/null --quiet ${LOCAL_DB_CREDS}
71+
${DB_ZCAT_CMD} "${TMP_DB_PATH}.gz" | docker exec -i ${LOCAL_DB_CONTAINER} ${LOCAL_PSQL_CMD} --output /dev/null --quiet ${LOCAL_DB_CREDS}
7272
echo "*** Restored docker Postgres database from ${TMP_DB_PATH}.gz"
7373
}
7474

scripts/docker_restore_db.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ esac
6060
# Functions
6161
function restore_local_from_dump_mysql() {
6262
# Restore the local db from the passed in db dump
63-
$CAT_CMD "${SRC_DB_PATH}" | docker exec -i devmode_postgres_1 ${LOCAL_MYSQL_CMD} ${LOCAL_DB_CREDS}
63+
$CAT_CMD "${SRC_DB_PATH}" | docker exec -i ${LOCAL_DB_CONTAINER} ${LOCAL_MYSQL_CMD} ${LOCAL_DB_CREDS}
6464
echo "*** Restored docker MySQL database from ${SRC_DB_PATH}"
6565
}
6666
function restore_local_from_dump_pgsql() {
6767
# Restore the local db from the passed in db dump
68-
$CAT_CMD "${SRC_DB_PATH}" | docker exec -i devmode_postgres_1 ${LOCAL_PSQL_CMD} --output /dev/null --quiet ${LOCAL_DB_CREDS}
68+
$CAT_CMD "${SRC_DB_PATH}" | docker exec -i ${LOCAL_DB_CONTAINER} ${LOCAL_PSQL_CMD} --output /dev/null --quiet ${LOCAL_DB_CREDS}
6969
echo "*** Restored docker Postgres database from ${SRC_DB_PATH}"
7070
}
7171

scripts/example.env.sh

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
# The database driver for this Craft install ('mysql' or 'pgsql')
1616
GLOBAL_DB_DRIVER="mysql"
1717

18+
# -- LOCAL settings --
19+
20+
LOCAL_DB_CONTAINER="REPLACE_ME"
21+
1822
# -- REMOTE settings --
1923

2024
# Remote ssh credentials, [email protected] and Remote SSH Port

0 commit comments

Comments
 (0)