mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-25 02:01:03 +00:00
Proactively verify if psql and sqlx are installed before moving forward with script execution.
This commit is contained in:
parent
6e31366fb2
commit
0c989497fc
1 changed files with 13 additions and 0 deletions
|
@ -2,6 +2,19 @@
|
||||||
set -x
|
set -x
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v psql)" ]; then
|
||||||
|
echo >&2 "Error: `psql` is not installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v sqlx)" ]; then
|
||||||
|
echo >&2 "Error: `sqlx` is not installed."
|
||||||
|
echo >&2 "Use:"
|
||||||
|
echo >&2 " cargo install --version=0.5.5 sqlx-cli --no-default-features --features postgres"
|
||||||
|
echo >&2 "to install it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if a custom user has been set, otherwise default to 'postgres'
|
# Check if a custom user has been set, otherwise default to 'postgres'
|
||||||
DB_USER="${POSTGRES_USER:=postgres}"
|
DB_USER="${POSTGRES_USER:=postgres}"
|
||||||
# Check if a custom password has been set, otherwise default to 'password'
|
# Check if a custom password has been set, otherwise default to 'password'
|
||||||
|
|
Loading…
Reference in a new issue