You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/26 21:05:13 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #17847: Sane detection of the host/port in entrypoint prod

potiuk commented on a change in pull request #17847:
URL: https://github.com/apache/airflow/pull/17847#discussion_r696977515



##########
File path: scripts/in_container/prod/entrypoint_prod.sh
##########
@@ -83,24 +84,12 @@ function wait_for_connection {
     # It tries `CONNECTION_CHECK_MAX_COUNT` times and sleeps `CONNECTION_CHECK_SLEEP_TIME` between checks
     local connection_url
     connection_url="${1}"
-    local detected_backend=""
-    local detected_host=""
-    local detected_port=""
-
-    # Auto-detect DB parameters
-    # Examples:
-    #  postgres://YourUserName:password@YourHostname:5432/YourDatabaseName
-    #  postgres://YourUserName:password@YourHostname:5432/YourDatabaseName
-    #  postgres://YourUserName:@YourHostname:/YourDatabaseName
-    #  postgres://YourUserName@YourHostname/YourDatabaseName
-    [[ ${connection_url} =~ ([^:]*)://([^:@]*):?([^@]*)@?([^/:]*):?([0-9]*)/([^\?]*)\??(.*) ]] && \
-        detected_backend=${BASH_REMATCH[1]} &&
-        # Not used USER match
-        # Not used PASSWORD match
-        detected_host=${BASH_REMATCH[4]} &&
-        detected_port=${BASH_REMATCH[5]} &&
-        # Not used SCHEMA match
-        # Not used PARAMS match
+    local detected_backend
+    detected_backend=$(python -c "from urllib.parse import urlsplit; print(urlsplit('${connection_url}').scheme)")

Review comment:
       I prefer to leave it explicit. I think it is far less readable with url_part parameter to be honest.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org