Skip to content

Commit

Permalink
Conditionally apply connect configs
Browse files Browse the repository at this point in the history
  • Loading branch information
enyachoke committed Jun 24, 2024
1 parent 814169e commit fedf810
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions development/setup-connect/setup-connect.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
set -e
echo "Waiting for source database to be ready-----"
/opt/wait-for-it.sh $SOURCE_DB_HOST:$SOURCE_DB_PORT
/opt/wait-for-it.sh $ODOO_DB_HOST:$ODOO_DB_PORT
CONNECT_OPENMRS="${CONNECT_OPENMRS:-1}"
CONNECT_ODOO="${CONNECT_ODOO:-1}"

echo "Waiting for connect to be ready-----"
/opt/wait-for-it.sh $CONNECT_HOST:8083
if [[ $CONNECT_OPENMRS = "1" ]]
then
echo "Waiting for OpenMRS database to be ready-----"
/opt/wait-for-it.sh $SOURCE_DB_HOST:$SOURCE_DB_PORT
curl --fail -i -X PUT -H "Accept:application/json" -H "Content-Type:application/json" http://${CONNECT_HOST}:8083/connectors/openmrs-connector/config/ \
-d '{
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
Expand All @@ -28,7 +31,13 @@ curl --fail -i -X PUT -H "Accept:application/json" -H "Content-Type:application/
"timestampConverter.debug": "false",
"snapshot.mode": "when_needed"
}'
fi


if [[ $CONNECT_ODOO = "1" ]]
then
echo "Waiting for Odoo database to be ready-----"
/opt/wait-for-it.sh $ODOO_DB_HOST:$ODOO_DB_PORT
curl --fail -i -X PUT -H "Accept:application/json" -H "Content-Type:application/json" http://${CONNECT_HOST}:8083/connectors/odoo-connector/config/ \
-d '{
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
Expand All @@ -55,3 +64,4 @@ curl --fail -i -X PUT -H "Accept:application/json" -H "Content-Type:application/
"publication.name": "odoo_publication",
"decimal.handling.mode": "double"
}'
fi

0 comments on commit fedf810

Please sign in to comment.