diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-10-10 17:42:56 -0400 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-10-10 17:42:56 -0400 |
| commit | 69809346b7c5c710eca080e5390244be53dc2732 (patch) | |
| tree | 4fdb6a63437ddd9d27eef5ddfb2cb8c2613dcb89 /tools/db.sh | |
| parent | Install shadow-uidmap instead of shadow (diff) | |
| download | cli-69809346b7c5c710eca080e5390244be53dc2732.zip | |
Replace tools with scripts and use them in .build.yml
Diffstat (limited to 'tools/db.sh')
| -rwxr-xr-x | tools/db.sh | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/tools/db.sh b/tools/db.sh deleted file mode 100755 index 8e6f2b9..0000000 --- a/tools/db.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# Start/Stop test databases. -# -# Subcommands: -# start <database-name>: Start a particular database. -# stop <database-name>: Stop a particular database. -# -# Usage: -# $ ./tools/db.sh start <database-name> -# $ ./tools/db.sh stop <database-name> -set +e - -SCRIPT_DIR=$(dirname "$0") -. "$SCRIPT_DIR/lib.sh" - -BASE_DIR=$(dirname "$0")/.. -ALLOWED_DBS=("postgresql" "mysql" "mssql") -ALLOWED_COMMANDS=("start" "stop") - -function main() { - local COMMAND="$1" - if ! elementIn "$COMMAND" "${ALLOWED_COMMANDS[@]}"; then - echo "Error: Invalid command. Allowed subcommands are: ${ALLOWED_COMMANDS[*]}" >&2 - exit 1 - fi - local DB_NAME="$2" - if ! elementIn "$DB_NAME" "${ALLOWED_DBS[@]}"; then - echo "Error: Invalid database type. Allowed types are: ${ALLOWED_DBS[*]}" >&2 - exit 1 - fi - - case $COMMAND in - start) - env $(cat "$BASE_DIR/.env.$DB_NAME" | xargs) docker compose -f "$BASE_DIR/docker-compose.$DB_NAME.yml" up -d - ;; - stop) - env $(cat "$BASE_DIR/.env.$DB_NAME" | xargs) docker compose -f "$BASE_DIR/docker-compose.$DB_NAME.yml" down - ;; - *) - echo "Error: Invalid command. Use 'start' or 'stop'." - exit 1 - ;; - esac -} - -main "$@" |