Fix deploy command (#1496)

This commit is contained in:
Nikhil Rao 2023-08-01 18:01:45 -07:00 committed by GitHub
parent f9be9d679a
commit deef553e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,7 @@ def init(
constants.Template.DEFAULT, help="The template to initialize the app with." constants.Template.DEFAULT, help="The template to initialize the app with."
), ),
loglevel: constants.LogLevel = typer.Option( loglevel: constants.LogLevel = typer.Option(
constants.LogLevel.INFO, help="The log level to use." console.LOG_LEVEL, help="The log level to use."
), ),
): ):
"""Initialize a new Reflex app in the current directory.""" """Initialize a new Reflex app in the current directory."""
@ -101,7 +101,7 @@ def run(
backend_port: str = typer.Option(None, help="Specify a different backend port."), backend_port: str = typer.Option(None, help="Specify a different backend port."),
backend_host: str = typer.Option(None, help="Specify the backend host."), backend_host: str = typer.Option(None, help="Specify the backend host."),
loglevel: constants.LogLevel = typer.Option( loglevel: constants.LogLevel = typer.Option(
constants.LogLevel.INFO, help="The log level to use." console.LOG_LEVEL, help="The log level to use."
), ),
): ):
"""Run the app in the current directory.""" """Run the app in the current directory."""
@ -180,19 +180,27 @@ def run(
@cli.command() @cli.command()
def deploy(dry_run: bool = typer.Option(False, help="Whether to run a dry run.")): def deploy(
dry_run: bool = typer.Option(False, help="Whether to run a dry run."),
loglevel: constants.LogLevel = typer.Option(
console.LOG_LEVEL, help="The log level to use."
),
):
"""Deploy the app to the Reflex hosting service.""" """Deploy the app to the Reflex hosting service."""
# Set the log level.
console.set_log_level(loglevel)
# Get the app config. # Get the app config.
config = get_config() config = get_config()
# Check if the deploy url is set. # Check if the deploy url is set.
if config.rxdeploy_url is None: if config.rxdeploy_url is None:
typer.echo("This feature is coming soon!") console.info("This feature is coming soon!")
return return
# Compile the app in production mode. # Compile the app in production mode.
typer.echo("Compiling production app") console.info("Compiling production app")
export() export(loglevel=loglevel)
# Exit early if this is a dry run. # Exit early if this is a dry run.
if dry_run: if dry_run:
@ -225,7 +233,7 @@ def export(
True, "--frontend-only", help="Export only frontend.", show_default=False True, "--frontend-only", help="Export only frontend.", show_default=False
), ),
loglevel: constants.LogLevel = typer.Option( loglevel: constants.LogLevel = typer.Option(
constants.LogLevel.INFO, help="The log level to use." console.LOG_LEVEL, help="The log level to use."
), ),
): ):
"""Export the app to a zip file.""" """Export the app to a zip file."""