-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathenv-mariadb.sh
executable file
·45 lines (37 loc) · 1.46 KB
/
env-mariadb.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
#! /usr/bin/env bash
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -euo pipefail
fi
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
cd "$(dirname "$0")"
if [[ $# -eq 0 ]] && [[ -z "${MARIADB_BROAD_VERSION:-}" ]]; then
echo "Usage: ./$(basename "$0") [latest/oldest]" >&2
exit 1
fi
container=mb-mariadb-db-${1:-$MARIADB_BROAD_VERSION}
port=$(docker port ${container} 3306/tcp | cut -d: -f2)
source ${SOURCE_DIR}/getenv.sh ${container} MYSQL_USER MYSQL_DATABASE
export MB_DB_TYPE=mysql
export MB_DB_DBNAME=${MYSQL_DATABASE}
export MB_DB_HOST=127.0.0.1
export MB_DB_PASS=
export MB_DB_PORT=${port}
export MB_DB_USER=${MYSQL_USER}
export MB_MYSQL_TEST_USER=${MB_DB_USER}
export MB_MYSQL_TEST_PASSWORD=
export MB_MYSQL_TEST_DBNAME=${MYSQL_DATABASE}
export MB_MYSQL_TEST_HOST=${MB_DB_HOST}
export MB_MYSQL_TEST_PORT=${MB_DB_PORT}
function print-mariadb-vars() {
cat <<EOF
Java properties:
-Dmb.mysql.test.host=localhost -Dmb.mysql.test.port=${MB_DB_PORT} -Dmb.mysql.test.db=${MB_DB_DBNAME} -Dmb.mysql.test.user=${MB_DB_USER} -Dmb.mysql.test.password=
Clojure pairs:
:mb-mysql-test-host "localhost" :mb-mysql-test-port "${MB_DB_PORT}" :mb-mysql-test-db "${MB_DB_DBNAME}" :mb-mysql-test-user "${MB_DB_USER}" :mb-mysql-test-password ""
Bash variables:
MB_MYSQL_TEST_HOST=localhost MB_MYSQL_TEST_PORT=${MB_DB_PORT} MB_MYSQL_TEST_DB=${MB_DB_DBNAME} MB_MYSQL_TEST_USER=${MB_DB_USER} MB_MYSQL_TEST_PASSWORD=''
EOF
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
print-mariadb-vars
fi