@@ -45,7 +45,7 @@ def start_loop(loop):
4545
4646
4747def get_config_variable (
48- env_var : str ,
48+ env_var : Union [ str , List [ str ]] ,
4949 yaml_path : List ,
5050 config : Dict = {},
5151 isNumber : Optional [bool ] = False ,
@@ -61,8 +61,17 @@ def get_config_variable(
6161 :param default: default value
6262 """
6363
64- if os .getenv (env_var ) is not None :
65- result = os .getenv (env_var )
64+ # Get env var
65+ env_result = None
66+ env_vars = env_var if type (env_var ) is list else [env_var ]
67+ for var in env_vars :
68+ if os .getenv (var ) is not None :
69+ env_result = os .getenv (var )
70+ break
71+
72+ # If env not found check in config file
73+ if env_result is not None :
74+ result = env_result
6675 elif yaml_path is not None :
6776 if yaml_path [0 ] in config and yaml_path [1 ] in config [yaml_path [0 ]]:
6877 result = config [yaml_path [0 ]][yaml_path [1 ]]
@@ -876,29 +885,31 @@ def __init__(self, config: Dict, playbook_compatible=False) -> None:
876885 "CONNECTOR_ID" , ["connector" , "id" ], config
877886 )
878887 self .listen_protocol = get_config_variable (
879- "LISTEN_PROTOCOL" , ["connector" , "listen_protocol" ], config , default = "AMQP"
888+ "CONNECTOR_LISTEN_PROTOCOL" ,
889+ ["connector" , "listen_protocol" ],
890+ config ,
891+ default = "AMQP" ,
880892 ).upper ()
881893 self .listen_protocol_api_port = get_config_variable (
882- "LISTEN_PROTOCOL_API_PORT " ,
894+ "CONNECTOR_LISTEN_PROTOCOL_API_PORT " ,
883895 ["connector" , "listen_protocol_api_port" ],
884896 config ,
885897 default = 7070 ,
886898 )
887899 self .listen_protocol_api_path = get_config_variable (
888- "LISTEN_PROTOCOL_API_PATH " ,
900+ "CONNECTOR_LISTEN_PROTOCOL_API_PATH " ,
889901 ["connector" , "listen_protocol_api_path" ],
890902 config ,
891903 default = "/api/callback" ,
892904 )
893905 self .listen_protocol_api_ssl = get_config_variable (
894- "LISTEN_PROTOCOL_API_SSL " ,
906+ "CONNECTOR_LISTEN_PROTOCOL_API_SSL " ,
895907 ["connector" , "listen_protocol_api_ssl" ],
896908 config ,
897909 default = False ,
898910 )
899-
900911 self .listen_protocol_api_uri = get_config_variable (
901- "LISTEN_PROTOCOL_API_URI " ,
912+ "CONNECTOR_LISTEN_PROTOCOL_API_URI " ,
902913 ["connector" , "listen_protocol_api_uri" ],
903914 config ,
904915 default = (
@@ -908,7 +919,10 @@ def __init__(self, config: Dict, playbook_compatible=False) -> None:
908919 ),
909920 )
910921 self .queue_protocol = get_config_variable (
911- "QUEUE_PROTOCOL" , ["connector" , "queue_protocol" ], config , default = "amqp"
922+ ["QUEUE_PROTOCOL" , "CONNECTOR_QUEUE_PROTOCOL" ],
923+ ["connector" , "queue_protocol" ],
924+ config ,
925+ default = "amqp" ,
912926 )
913927 self .connect_type = get_config_variable (
914928 "CONNECTOR_TYPE" , ["connector" , "type" ], config
0 commit comments