Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows to override metabase db cfg values #93

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ METABASE_PORT=3000
METABASE_USER=admin@admin.com
METABASE_PASSWORD=admin
METABASE_URL=http://metabase:3000
METABASE_USE_SSL=false
# The db_host used in Metabase to connect to the Faros database.
METABASE_FAROS_DB_HOST=faros-db

############################## n8n ############################################
N8N_DB_NAME=n8n
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ services:
FAROS_EMAIL: ${FAROS_EMAIL}
HASURA_URL: ${HASURA_URL?}
LOG_LEVEL: ${FAROS_INIT_LOG_LEVEL:-info}
METABASE_FAROS_DB_HOST: ${METABASE_FAROS_DB_HOST?}
METABASE_PASSWORD: ${METABASE_PASSWORD?}
METABASE_URL: ${METABASE_URL?}
METABASE_USER: ${METABASE_USER?}
METABASE_USE_SSL: ${METABASE_USE_SSL?}
FAROS_DB_NAME: ${FAROS_DB_NAME?}
FAROS_DB_HOST: ${FAROS_DB_HOST?}
FAROS_DB_PORT: ${FAROS_DB_PORT?}
Expand Down
6 changes: 4 additions & 2 deletions init/scripts/metabase-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
[[ -z "$METABASE_USER" ]] && echo "METABASE_USER not set" && exit 1
[[ -z "$METABASE_PASSWORD" ]] && echo "METABASE_PASSWORD not set" && exit 1

db_host=$FAROS_DB_HOST
db_host=$METABASE_FAROS_DB_HOST
db_port=$FAROS_DB_PORT
db_name=$FAROS_DB_NAME
db_user=$FAROS_DB_USER
db_password=$FAROS_DB_PASSWORD
use_ssl=$METABASE_USE_SSL

mb_url=$METABASE_URL
mb_user=$METABASE_USER
Expand All @@ -20,6 +21,7 @@ mb_db_payload=$(jq -n \
--arg db_name "$db_name" \
--arg db_user "$db_user" \
--arg db_password "$db_password" \
--argjson use_ssl "$use_ssl" \
'{
"engine": "postgres",
"name": "Faros Data",
Expand All @@ -29,7 +31,7 @@ mb_db_payload=$(jq -n \
"dbname": $db_name,
"user": $db_user,
"password": $db_password,
"ssl": false,
"ssl": $use_ssl,
"additional-options": null,
"tunnel-enabled": false,
"let-user-control-scheduling": false
Expand Down