potiuk commented on code in PR #37214:
URL: https://github.com/apache/airflow/pull/37214#discussion_r1482504765


##########
airflow/providers/mongo/hooks/mongo.py:
##########
@@ -75,6 +74,23 @@ def __init__(self, mongo_conn_id: str = default_conn_name, 
*args, **kwargs) -> N
         self.client: MongoClient | None = None
         self.uri = self._create_uri()
 
+        self.allow_insecure = self.extras.pop("allow_insecure", 
"false").lower() == "true"
+        self.ssl_enabled = self.extras.get("ssl", "false").lower() == "true"
+
+        if self.ssl_enabled and not self.allow_insecure:
+            # Case: HTTPS
+            self.allow_insecure = False
+        elif self.ssl_enabled and self.allow_insecure:
+            # Case: HTTPS + allow_insecure
+            self.allow_insecure = True
+            self.extras.pop("ssl", None)
+        elif not self.ssl_enabled and "allow_insecure" in self.extras:
+            # Case: HTTP (ssl=False) with allow_insecure specified

Review Comment:
   NIT: we can add  warning here, since "allow_insecure" + "ssl = False" does 
not make sense (i.e. "allow_insecure" only makes sense in "ssl" context.



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to