add v1 support
This commit is contained in:
parent
01e3844ac4
commit
c216eeafeb
118
reflex/reflex.py
118
reflex/reflex.py
@ -10,6 +10,7 @@ from typing import List, Optional
|
|||||||
import typer
|
import typer
|
||||||
import typer.core
|
import typer.core
|
||||||
from reflex_cli.deployments import deployments_cli
|
from reflex_cli.deployments import deployments_cli
|
||||||
|
from reflex_cli.v2.deployments import hosting_cli
|
||||||
from reflex_cli.utils import dependency
|
from reflex_cli.utils import dependency
|
||||||
|
|
||||||
from reflex import constants
|
from reflex import constants
|
||||||
@ -383,6 +384,13 @@ def login(
|
|||||||
_login()
|
_login()
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
def loginv2(loglevel: constants.LogLevel = typer.Option(config.loglevel)):
|
||||||
|
from reflex_cli.v2 import cli as hosting_cli
|
||||||
|
|
||||||
|
hosting_cli.login()
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
def logout(
|
def logout(
|
||||||
loglevel: constants.LogLevel = typer.Option(
|
loglevel: constants.LogLevel = typer.Option(
|
||||||
@ -569,12 +577,7 @@ def deploy(
|
|||||||
|
|
||||||
hosting_cli.deploy(
|
hosting_cli.deploy(
|
||||||
app_name=app_name,
|
app_name=app_name,
|
||||||
export_fn=lambda zip_dest_dir,
|
export_fn=lambda zip_dest_dir, api_url, deploy_url, frontend, backend, zipping: export_utils.export(
|
||||||
api_url,
|
|
||||||
deploy_url,
|
|
||||||
frontend,
|
|
||||||
backend,
|
|
||||||
zipping: export_utils.export(
|
|
||||||
zip_dest_dir=zip_dest_dir,
|
zip_dest_dir=zip_dest_dir,
|
||||||
api_url=api_url,
|
api_url=api_url,
|
||||||
deploy_url=deploy_url,
|
deploy_url=deploy_url,
|
||||||
@ -599,6 +602,104 @@ def deploy(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
def deployv2(
|
||||||
|
app_name: str = typer.Option(
|
||||||
|
config.app_name,
|
||||||
|
"--app-name",
|
||||||
|
help="The name of the App to deploy under.",
|
||||||
|
hidden=True,
|
||||||
|
),
|
||||||
|
regions: List[str] = typer.Option(
|
||||||
|
list(),
|
||||||
|
"-r",
|
||||||
|
"--region",
|
||||||
|
help="The regions to deploy to. For multiple envs, repeat this option, e.g. --region sjc --region iad",
|
||||||
|
),
|
||||||
|
envs: List[str] = typer.Option(
|
||||||
|
list(),
|
||||||
|
"--env",
|
||||||
|
help="The environment variables to set: <key>=<value>. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.",
|
||||||
|
),
|
||||||
|
vmtype: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--vmtype",
|
||||||
|
help="Vm type id. Run reflex apps vmtypes list to get options.",
|
||||||
|
),
|
||||||
|
hostname: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--hostname",
|
||||||
|
help="The hostname of the frontend.",
|
||||||
|
hidden=True,
|
||||||
|
),
|
||||||
|
interactive: bool = typer.Option(
|
||||||
|
True,
|
||||||
|
help="Whether to list configuration options and ask for confirmation.",
|
||||||
|
),
|
||||||
|
envfile: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--envfile",
|
||||||
|
help="The path to an env file to use. Will override any envs set manually.",
|
||||||
|
hidden=True,
|
||||||
|
),
|
||||||
|
loglevel: constants.LogLevel = typer.Option(
|
||||||
|
config.loglevel, help="The log level to use."
|
||||||
|
),
|
||||||
|
project: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--project",
|
||||||
|
help="project to deploy to",
|
||||||
|
hidden=True,
|
||||||
|
),
|
||||||
|
token: Optional[str] = typer.Option(
|
||||||
|
None,
|
||||||
|
"--token",
|
||||||
|
help="token to use for auth",
|
||||||
|
hidden=True,
|
||||||
|
),
|
||||||
|
):
|
||||||
|
"""Deploy the app to the Reflex hosting service."""
|
||||||
|
from reflex_cli.v2 import cli as hosting_cli
|
||||||
|
|
||||||
|
from reflex.utils import prerequisites
|
||||||
|
from reflex.utils import export as export_utils
|
||||||
|
from reflex_cli.v2.utils import dependency
|
||||||
|
|
||||||
|
# Set the log level.
|
||||||
|
console.set_log_level(loglevel)
|
||||||
|
|
||||||
|
# Only check requirements if interactive. There is user interaction for requirements update.
|
||||||
|
if interactive:
|
||||||
|
dependency.check_requirements()
|
||||||
|
|
||||||
|
# Check if we are set up.
|
||||||
|
if prerequisites.needs_reinit(frontend=True):
|
||||||
|
_init(name=config.app_name, loglevel=loglevel)
|
||||||
|
prerequisites.check_latest_package_version(constants.ReflexHostingCLI.MODULE_NAME)
|
||||||
|
|
||||||
|
hosting_cli.deploy(
|
||||||
|
app_name=app_name,
|
||||||
|
export_fn=lambda zip_dest_dir, api_url, deploy_url, frontend, backend, zipping: export_utils.export(
|
||||||
|
zip_dest_dir=zip_dest_dir,
|
||||||
|
api_url=api_url,
|
||||||
|
deploy_url=deploy_url,
|
||||||
|
frontend=frontend,
|
||||||
|
backend=backend,
|
||||||
|
zipping=zipping,
|
||||||
|
loglevel=loglevel.subprocess_level(),
|
||||||
|
),
|
||||||
|
regions=regions,
|
||||||
|
envs=envs,
|
||||||
|
vmtype=vmtype,
|
||||||
|
envfile=envfile,
|
||||||
|
hostname=hostname,
|
||||||
|
interactive=interactive,
|
||||||
|
loglevel=loglevel.subprocess_level(),
|
||||||
|
token=token,
|
||||||
|
project=project,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.")
|
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.")
|
||||||
cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.")
|
cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.")
|
||||||
cli.add_typer(
|
cli.add_typer(
|
||||||
@ -606,6 +707,11 @@ cli.add_typer(
|
|||||||
name="deployments",
|
name="deployments",
|
||||||
help="Subcommands for managing the Deployments.",
|
help="Subcommands for managing the Deployments.",
|
||||||
)
|
)
|
||||||
|
cli.add_typer(
|
||||||
|
hosting_cli,
|
||||||
|
name="apps",
|
||||||
|
help="Subcommands for managing the Deployments.",
|
||||||
|
)
|
||||||
cli.add_typer(
|
cli.add_typer(
|
||||||
custom_components_cli,
|
custom_components_cli,
|
||||||
name="component",
|
name="component",
|
||||||
|
Loading…
Reference in New Issue
Block a user