@@ -557,7 +557,7 @@ def deploy(
557557 skip_wait : Annotated [
558558 bool , typer .Option ("--no-wait" , help = "Skip waiting for deployment status" )
559559 ] = False ,
560- app_id : Annotated [
560+ provided_app_id : Annotated [
561561 Union [str , None ],
562562 typer .Option (
563563 "--app-id" ,
@@ -570,7 +570,9 @@ def deploy(
570570 Deploy a [bold]FastAPI[/bold] app to FastAPI Cloud. 🚀
571571 """
572572 logger .debug ("Deploy command started" )
573- logger .debug ("Deploy path: %s, skip_wait: %s, app_id: %s" , path , skip_wait , app_id )
573+ logger .debug (
574+ "Deploy path: %s, skip_wait: %s, app_id: %s" , path , skip_wait , provided_app_id
575+ )
574576
575577 identity = Identity ()
576578
@@ -612,15 +614,9 @@ def deploy(
612614
613615 app_config = get_app_config (path_to_deploy )
614616
615- if app_id and app_config and app_id != app_config .app_id :
616- logger .debug (
617- "Provided app_id (%s) differs from local config (%s)" ,
618- app_id ,
619- app_config .app_id ,
620- )
621-
617+ if app_config and provided_app_id and app_config .app_id != provided_app_id :
622618 toolkit .print (
623- f"[error]Error: Provided app ID ({ app_id } ) does not match the local "
619+ f"[error]Error: Provided app ID ({ provided_app_id } ) does not match the local "
624620 f"config ({ app_config .app_id } ).[/]"
625621 )
626622 toolkit .print_line ()
@@ -629,17 +625,22 @@ def deploy(
629625 "or remove --app-id / unset FASTAPI_CLOUD_APP_ID to use the configured app." ,
630626 tag = "tip" ,
631627 )
632- raise typer .Exit (1 ) from None
633628
634- target_app_id = app_id or ( app_config . app_id if app_config else None )
629+ raise typer . Exit ( 1 ) from None
635630
636- if not target_app_id :
631+ if provided_app_id :
632+ target_app_id = provided_app_id
633+ elif app_config :
634+ target_app_id = app_config .app_id
635+ else :
637636 logger .debug ("No app config found, configuring new app" )
637+
638638 app_config = _configure_app (toolkit , path_to_deploy = path_to_deploy )
639639 toolkit .print_line ()
640+
640641 target_app_id = app_config .app_id
641642
642- if app_id :
643+ if provided_app_id :
643644 toolkit .print (f"Deploying to app [blue]{ target_app_id } [/blue]..." )
644645 else :
645646 toolkit .print ("Deploying app..." )
@@ -659,7 +660,8 @@ def deploy(
659660
660661 if not app :
661662 toolkit .print_line ()
662- if not app_id :
663+
664+ if not provided_app_id :
663665 toolkit .print (
664666 "If you deleted this app, you can run [bold]fastapi cloud unlink[/] to unlink the local configuration." ,
665667 tag = "tip" ,
0 commit comments