|
@@ -133,7 +133,7 @@ Config = t.TypedDict(
|
|
|
"use_reloader": bool,
|
|
|
"watermark": t.Optional[str],
|
|
|
"webapp_path": t.Optional[str],
|
|
|
- "port": int,
|
|
|
+ "port": t.Union[t.Literal["auto"], int],
|
|
|
},
|
|
|
total=False,
|
|
|
)
|
|
@@ -189,7 +189,9 @@ class _Config(object):
|
|
|
|
|
|
config = self.config
|
|
|
if args.taipy_port:
|
|
|
- if not _Config.__RE_PORT_NUMBER.match(args.taipy_port):
|
|
|
+ if str(args.taipy_port).strip() == "auto":
|
|
|
+ config["port"] = "auto"
|
|
|
+ elif not _Config.__RE_PORT_NUMBER.match(args.taipy_port):
|
|
|
_warn("Port value for --port option is not valid.")
|
|
|
else:
|
|
|
config["port"] = int(args.taipy_port)
|
|
@@ -226,6 +228,8 @@ class _Config(object):
|
|
|
try:
|
|
|
if isinstance(value, dict) and isinstance(config[key], dict):
|
|
|
config[key].update(value)
|
|
|
+ elif key == "port" and str(value).strip() == "auto":
|
|
|
+ config["port"] = "auto"
|
|
|
else:
|
|
|
config[key] = value if config[key] is None else type(config[key])(value) # type: ignore
|
|
|
except Exception as e:
|
|
@@ -239,7 +243,10 @@ class _Config(object):
|
|
|
key = key.lower()
|
|
|
if value is not None and key in config:
|
|
|
try:
|
|
|
- config[key] = value if config[key] is None else type(config[key])(value) # type: ignore
|
|
|
+ if key == "port" and str(value).strip() == "auto":
|
|
|
+ config["port"] = "auto"
|
|
|
+ else:
|
|
|
+ config[key] = value if config[key] is None else type(config[key])(value) # type: ignore
|
|
|
except Exception as e:
|
|
|
_warn(
|
|
|
f"Invalid env value in Gui.run(): {key} - {value}. Unable to parse value to the correct type", # noqa: E501
|