11from typing import Optional
22import os
3+ from feldera .rest ._helpers import requests_verify_from_env
4+ import logging
35
46
57class Config :
@@ -14,7 +16,7 @@ def __init__(
1416 version : Optional [str ] = None ,
1517 timeout : Optional [float ] = None ,
1618 connection_timeout : Optional [float ] = None ,
17- requests_verify : bool | str = True ,
19+ requests_verify : Optional [ bool | str ] = None ,
1820 ) -> None :
1921 """
2022 :param url: The url to the Feldera API (ex: https://try.feldera.com)
@@ -23,7 +25,10 @@ def __init__(
2325 :param timeout: The timeout for the HTTP requests
2426 :param connection_timeout: The connection timeout for the HTTP requests
2527 :param requests_verify: The `verify` parameter passed to the requests
26- library. `True` by default.
28+ library. `True` by default. Can also be set using environment
29+ variables `FELDERA_TLS_INSECURE` to disable TLS and
30+ `FELDERA_HTTPS_TLS_CERT` to set the certificate path. The latter
31+ takes priority.
2732 """
2833
2934 BASE_URL = (
@@ -37,11 +42,10 @@ def __init__(
3742 self .version : Optional [str ] = version or "v0"
3843 self .timeout : Optional [float ] = timeout
3944 self .connection_timeout : Optional [float ] = connection_timeout
45+ env_verify = requests_verify_from_env ()
46+ self .requests_verify : bool | str = (
47+ requests_verify if requests_verify is not None else env_verify
48+ )
4049
41- FELDERA_TLS_INSECURE = True if os .environ .get ("FELDERA_TLS_INSECURE" ) else False
42- FELDERA_HTTPS_TLS_CERT = os .environ .get ("FELDERA_HTTPS_TLS_CERT" )
43- requests_verify = not FELDERA_TLS_INSECURE
44- if requests_verify and FELDERA_HTTPS_TLS_CERT is not None :
45- requests_verify = FELDERA_HTTPS_TLS_CERT
46-
47- self .requests_verify : bool | str = requests_verify
50+ if self .requests_verify is False :
51+ logging .warning ("TLS verification is disabled." )
0 commit comments