You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/11/18 23:51:16 UTC
[airflow] 04/07: Fix Entrypoint and _CMD config variables (#12411)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 7f9105a903976c57e0cd69815be5d673cc4f1f78
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Wed Nov 18 00:47:13 2020 +0000
Fix Entrypoint and _CMD config variables (#12411)
closes https://github.com/apache/airflow/issues/8705
Co-Authored-By: Noël Bardelot <11...@users.noreply.github.com>
(cherry picked from commit f4851f7d75d45f85204e3ceba77c8b8e479a1d7c)
---
scripts/in_container/prod/entrypoint_prod.sh | 30 +++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/scripts/in_container/prod/entrypoint_prod.sh b/scripts/in_container/prod/entrypoint_prod.sh
index 6843919..60103e7 100755
--- a/scripts/in_container/prod/entrypoint_prod.sh
+++ b/scripts/in_container/prod/entrypoint_prod.sh
@@ -99,16 +99,28 @@ if ! whoami &> /dev/null; then
fi
-# if no DB configured - use sqlite db by default
-AIRFLOW__CORE__SQL_ALCHEMY_CONN="${AIRFLOW__CORE__SQL_ALCHEMY_CONN:="sqlite:///${AIRFLOW_HOME}/airflow.db"}"
-
-verify_db_connection "${AIRFLOW__CORE__SQL_ALCHEMY_CONN}"
-
-AIRFLOW__CELERY__BROKER_URL=${AIRFLOW__CELERY__BROKER_URL:=}
+# Warning: command environment variables (*_CMD) have priority over usual configuration variables
+# for configuration parameters that require sensitive information. This is the case for the SQL database
+# and the broker backend in this entrypoint script.
+
+if [[ -n "${AIRFLOW__CORE__SQL_ALCHEMY_CONN_CMD=}" ]]; then
+ verify_db_connection "$(eval "$AIRFLOW__CORE__SQL_ALCHEMY_CONN_CMD")"
+else
+ # if no DB configured - use sqlite db by default
+ AIRFLOW__CORE__SQL_ALCHEMY_CONN="${AIRFLOW__CORE__SQL_ALCHEMY_CONN:="sqlite:///${AIRFLOW_HOME}/airflow.db"}"
+ verify_db_connection "${AIRFLOW__CORE__SQL_ALCHEMY_CONN}"
+fi
-if [[ -n ${AIRFLOW__CELERY__BROKER_URL=} ]] && \
- [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|worker|flower)$ ]]; then
- verify_db_connection "${AIRFLOW__CELERY__BROKER_URL}"
+# Note: the broker backend configuration concerns only a subset of Airflow components
+if [[ ${AIRFLOW_COMMAND} =~ ^(scheduler|worker|flower)$ ]]; then
+ if [[ -n "${AIRFLOW__CELERY__BROKER_URL_CMD=}" ]]; then
+ verify_db_connection "$(eval "$AIRFLOW__CELERY__BROKER_URL_CMD")"
+ else
+ AIRFLOW__CELERY__BROKER_URL=${AIRFLOW__CELERY__BROKER_URL:=}
+ if [[ -n ${AIRFLOW__CELERY__BROKER_URL=} ]]; then
+ verify_db_connection "${AIRFLOW__CELERY__BROKER_URL}"
+ fi
+ fi
fi
if [[ ${AIRFLOW_COMMAND} == "bash" ]]; then