@@ -44,10 +44,19 @@ def parse_cli_args():
44
44
return args
45
45
46
46
47
+ def handle_legacy_port_config ():
48
+ """Handle legacy port configuration."""
49
+ if CONFIG .flowkit_python_address != "" :
50
+ return CONFIG .flowkit_python_address
51
+ if CONFIG .flowkit_python_endpoint != "" :
52
+ return CONFIG .flowkit_python_endpoint
53
+
54
+
47
55
def substitute_empty_values (args ):
48
56
"""Substitute the empty values with configuration values."""
49
- port = args .port or urlparse (CONFIG .flowkit_python_endpoint ).port
50
- CONFIG .flowkit_python_endpoint = f"http://0.0.0.0:{ port } "
57
+ CONFIG .flowkit_python_address = (
58
+ f"{ args .host } :{ args .port } " if args .host is not None and args .port is not None else CONFIG .flowkit_python_address
59
+ )
51
60
CONFIG .flowkit_python_workers = args .workers or CONFIG .flowkit_python_workers
52
61
CONFIG .use_ssl = (args .use_ssl .lower () == "true" ) if args .use_ssl is not None else CONFIG .use_ssl
53
62
CONFIG .ssl_cert_private_key_file = args .ssl_keyfile or CONFIG .ssl_cert_private_key_file
@@ -64,12 +73,17 @@ def main():
64
73
# Substitute the empty values with configuration values
65
74
substitute_empty_values (args )
66
75
67
- port = urlparse (CONFIG .flowkit_python_endpoint ).port
76
+ address = handle_legacy_port_config ()
77
+ # Add scheme if missing
78
+ if not address .startswith (("http://" , "https://" )):
79
+ address = "http://" + address
80
+ host = urlparse (address ).hostname
81
+ port = urlparse (address ).port
68
82
69
83
# Run the service
70
84
uvicorn .run (
71
85
"aali.flowkit.flowkit_service:flowkit_service" ,
72
- host = "0.0.0.0" ,
86
+ host = host ,
73
87
port = port ,
74
88
workers = CONFIG .flowkit_python_workers ,
75
89
ssl_keyfile = CONFIG .ssl_cert_private_key_file if CONFIG .use_ssl else None ,
0 commit comments