|
1 |
| -#! /usr/bin/env bash |
| 1 | +#!/usr/bin/env bash |
2 | 2 |
|
3 |
| -set -euo pipefail |
| 3 | +SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"` |
| 4 | +cd "$(dirname "$0")" |
4 | 5 |
|
5 |
| -CONTAINER_NAME=mb-postgres-db |
6 |
| -HOST_PORT=${PGSQL_PORT:-5432} |
7 |
| -DB_NAME=metabase |
8 |
| -DB_USER=metabase |
9 |
| -DB_PASSWORD=password |
| 6 | +# `oldest` or `latest` |
| 7 | +container=mb-postgres-db-${1:-$PG_BROAD_VERSION} |
| 8 | +port=$(docker port ${container} 5432/tcp | cut -d: -f2) |
| 9 | +source ${SOURCE_DIR}/getenv.sh ${container} POSTGRES_USER POSTGRES_DB POSTGRES_PASSWORD |
| 10 | + |
| 11 | +export DRIVERS=postgres |
| 12 | +export MB_DB_TYPE=postgres |
| 13 | +export MB_DB_DBNAME=${POSTGRES_DB} |
| 14 | +export MB_DB_HOST=127.0.0.1 |
| 15 | +export MB_DB_PASS=${POSTGRES_PASSWORD} |
| 16 | +export MB_DB_PORT=${port} |
| 17 | +export MB_DB_USER=${POSTGRES_USER} |
| 18 | + |
| 19 | +export MB_POSTGRESQL_TEST_USER=${MB_DB_USER} |
| 20 | +export MB_POSTGRESQL_TEST_PASSWORD=${MB_DB_PASS} |
| 21 | +export MB_POSTGRESQL_TEST_DBNAME=${MB_DB_DBNAME} |
| 22 | +export MB_POSTGRESQL_TEST_HOST=${MB_DB_HOST} |
| 23 | +export MB_POSTGRESQL_TEST_PORT=${MB_DB_PORT} |
| 24 | + |
| 25 | +export PGHOST=${MB_DB_HOST} |
| 26 | +export PGPORT=${MB_DB_PORT} |
| 27 | +export PGUSER=${MB_DB_USER} |
| 28 | +export PGPASSWORK=${MB_DB_PASS} |
| 29 | +export PGDATABASE=${MB_DB_DBNAME} |
10 | 30 |
|
11 | 31 | function print-postgres-vars() {
|
12 | 32 | cat <<EOF
|
13 | 33 | Java properties:
|
14 |
| --Dmb.postgresql.test.host=localhost -Dmb.postgresql.test.port=${HOST_PORT} -Dmb.postgresql.test.db=${DB_NAME} -Dmb.postgresql.test.user=${DB_USER} -Dmb.postgresql.test.password=${DB_PASSWORD} |
| 34 | +-Dmb.postgresql.test.host=localhost -Dmb.postgresql.test.port=${MB_DB_PORT} -Dmb.postgresql.test.db=${MB_DB_DBNAME} -Dmb.postgresql.test.user=${MB_DB_USER} -Dmb.postgresql.test.password=${MB_DB_PASS} |
15 | 35 |
|
16 | 36 | Clojure pairs:
|
17 |
| -:mb-postgresql-test-host "localhost" :mb-postgresql-test-port "${HOST_PORT}" :mb-postgresql-test-db "${DB_NAME}" :mb-postgresql-test-user "${DB_USER}" :mb-postgresql-test-password "${DB_PASSWORD}" |
| 37 | +:mb-postgresql-test-host "localhost" :mb-postgresql-test-port "${MB_DB_PORT}" :mb-postgresql-test-db "${MB_DB_DBNAME}" :mb-postgresql-test-user "${MB_DB_USER}" :mb-postgresql-test-password "${MB_DB_PASS}" |
18 | 38 |
|
19 | 39 | Bash variables:
|
20 |
| -MB_POSTGRESQL_TEST_HOST=localhost MB_POSTGRESQL_TEST_PORT=${HOST_PORT} MB_POSTGRESQL_TEST_DB=${DB_NAME} MB_POSTGRESQL_TEST_USER=${DB_USER} MB_POSTGRESQL_TEST_PASSWORD=${DB_PASSWORD} |
| 40 | +MB_POSTGRESQL_TEST_HOST=localhost MB_POSTGRESQL_TEST_PORT=${MB_DB_PORT} MB_POSTGRESQL_TEST_DB=${MB_DB_DBNAME} MB_POSTGRESQL_TEST_USER=${MB_DB_USER} MB_POSTGRESQL_TEST_PASSWORD=${MB_DB_PASS} |
21 | 41 | EOF
|
22 | 42 | }
|
23 | 43 |
|
|
0 commit comments