@@ -81,6 +81,19 @@ def is_str_dict(val: Any) -> TypeGuard[TaskParameters]:
8181 invoke_without_command = True , context_settings = {"auto_envvar_prefix" : "BLUEAPI" }
8282)
8383@click .version_option (version = __version__ , prog_name = "blueapi" )
84+ @click .option (
85+ "-h" ,
86+ "--host" ,
87+ type = str ,
88+ help = textwrap .dedent (
89+ """
90+ Hostname for the blueapi instance to use
91+
92+ Value should be the full URL including scheme (and port if non-default),
93+ eg `--host http://localhost:8000`
94+ """
95+ ),
96+ )
8497@click .option (
8598 "-c" , "--config" , type = Path , help = "Path to configuration YAML file" , multiple = True
8699)
@@ -100,7 +113,10 @@ def is_str_dict(val: Any) -> TypeGuard[TaskParameters]:
100113)
101114@click .pass_context
102115def main (
103- ctx : click .Context , config : tuple [Path , ...], log_level : str | None = None
116+ ctx : click .Context ,
117+ config : tuple [Path , ...],
118+ host : str | None = None ,
119+ log_level : str | None = None ,
104120) -> None :
105121 # if no command is supplied, run with the options passed
106122
@@ -112,7 +128,8 @@ def main(
112128 config_loader .use_values_from_yaml (* config )
113129 except FileNotFoundError as fnfe :
114130 raise ClickException (f"Config file not found: { fnfe .filename } " ) from fnfe
115-
131+ if host :
132+ config_loader .use_values ({"api" : {"url" : host }})
116133 if log_level :
117134 config_loader .use_values ({"logging" : {"level" : log_level }})
118135
0 commit comments