remove v2 commands
This commit is contained in:
parent
c721227a06
commit
fbb5be2296
@ -49,7 +49,7 @@ wrapt = [
|
||||
{version = ">=1.11.0,<2.0", python = "<3.11"},
|
||||
]
|
||||
packaging = ">=23.1,<25.0"
|
||||
reflex-hosting-cli = ">=0.1.17,<2.0"
|
||||
reflex-hosting-cli = ">=0.1.27,<2.0"
|
||||
charset-normalizer = ">=3.3.2,<4.0"
|
||||
wheel = ">=0.42.0,<1.0"
|
||||
build = ">=1.0.3,<2.0"
|
||||
|
181
reflex/reflex.py
181
reflex/reflex.py
@ -330,41 +330,8 @@ def export(
|
||||
)
|
||||
|
||||
|
||||
def _login() -> str:
|
||||
"""Helper function to authenticate with Reflex hosting service."""
|
||||
from reflex_cli.utils import hosting
|
||||
|
||||
access_token, invitation_code = hosting.authenticated_token()
|
||||
if access_token:
|
||||
console.print("You already logged in.")
|
||||
return access_token
|
||||
|
||||
# If not already logged in, open a browser window/tab to the login page.
|
||||
access_token = hosting.authenticate_on_browser(invitation_code)
|
||||
|
||||
if not access_token:
|
||||
console.error("Unable to authenticate. Please try again or contact support.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
console.print("Successfully logged in.")
|
||||
return access_token
|
||||
|
||||
|
||||
@cli.command()
|
||||
def login(
|
||||
loglevel: constants.LogLevel = typer.Option(
|
||||
config.loglevel, help="The log level to use."
|
||||
),
|
||||
):
|
||||
"""Authenticate with Reflex hosting service."""
|
||||
# Set the log level.
|
||||
console.set_log_level(loglevel)
|
||||
|
||||
_login()
|
||||
|
||||
|
||||
@cli.command()
|
||||
def loginv2(loglevel: constants.LogLevel = typer.Option(config.loglevel)):
|
||||
def login(loglevel: constants.LogLevel = typer.Option(config.loglevel)):
|
||||
"""Authenicate with experimental Reflex hosting service."""
|
||||
from reflex_cli.v2 import cli as hosting_cli
|
||||
|
||||
@ -373,22 +340,6 @@ def loginv2(loglevel: constants.LogLevel = typer.Option(config.loglevel)):
|
||||
hosting_cli.login()
|
||||
|
||||
|
||||
@cli.command()
|
||||
def logout(
|
||||
loglevel: constants.LogLevel = typer.Option(
|
||||
config.loglevel, help="The log level to use."
|
||||
),
|
||||
):
|
||||
"""Log out of access to Reflex hosting service."""
|
||||
from reflex_cli.utils import hosting
|
||||
|
||||
console.set_log_level(loglevel)
|
||||
|
||||
hosting.log_out_on_browser()
|
||||
console.debug("Deleting access token from config locally")
|
||||
hosting.delete_token_from_config(include_invitation_code=True)
|
||||
|
||||
|
||||
@cli.command()
|
||||
def logoutv2(
|
||||
loglevel: constants.LogLevel = typer.Option(
|
||||
@ -396,15 +347,11 @@ def logoutv2(
|
||||
),
|
||||
):
|
||||
"""Log out of access to Reflex hosting service."""
|
||||
from reflex_cli.v2.utils import hosting
|
||||
from reflex_cli.v2.cli import logout
|
||||
|
||||
check_version()
|
||||
|
||||
console.set_log_level(loglevel)
|
||||
|
||||
hosting.log_out_on_browser()
|
||||
console.debug("Deleting access token from config locally")
|
||||
hosting.delete_token_from_config()
|
||||
logout(loglevel)
|
||||
|
||||
|
||||
db_cli = typer.Typer()
|
||||
@ -487,126 +434,6 @@ def makemigrations(
|
||||
)
|
||||
|
||||
|
||||
@cli.command()
|
||||
def deploy(
|
||||
key: Optional[str] = typer.Option(
|
||||
None,
|
||||
"-k",
|
||||
"--deployment-key",
|
||||
help="The name of the deployment. Domain name safe characters only.",
|
||||
),
|
||||
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.",
|
||||
),
|
||||
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.",
|
||||
),
|
||||
cpus: Optional[int] = typer.Option(
|
||||
None, help="The number of CPUs to allocate.", hidden=True
|
||||
),
|
||||
memory_mb: Optional[int] = typer.Option(
|
||||
None, help="The amount of memory to allocate.", hidden=True
|
||||
),
|
||||
auto_start: Optional[bool] = typer.Option(
|
||||
None,
|
||||
help="Whether to auto start the instance.",
|
||||
hidden=True,
|
||||
),
|
||||
auto_stop: Optional[bool] = typer.Option(
|
||||
None,
|
||||
help="Whether to auto stop the instance.",
|
||||
hidden=True,
|
||||
),
|
||||
frontend_hostname: Optional[str] = typer.Option(
|
||||
None,
|
||||
"--frontend-hostname",
|
||||
help="The hostname of the frontend.",
|
||||
hidden=True,
|
||||
),
|
||||
interactive: bool = typer.Option(
|
||||
True,
|
||||
help="Whether to list configuration options and ask for confirmation.",
|
||||
),
|
||||
with_metrics: Optional[str] = typer.Option(
|
||||
None,
|
||||
help="Setting for metrics scraping for the deployment. Setup required in user code.",
|
||||
hidden=True,
|
||||
),
|
||||
with_tracing: Optional[str] = typer.Option(
|
||||
None,
|
||||
help="Setting to export tracing for the deployment. Setup required in user code.",
|
||||
hidden=True,
|
||||
),
|
||||
upload_db_file: bool = typer.Option(
|
||||
False,
|
||||
help="Whether to include local sqlite db files when uploading to hosting service.",
|
||||
hidden=True,
|
||||
),
|
||||
loglevel: constants.LogLevel = typer.Option(
|
||||
config.loglevel, help="The log level to use."
|
||||
),
|
||||
):
|
||||
"""Deploy the app to the Reflex hosting service."""
|
||||
from reflex_cli import cli as hosting_cli
|
||||
|
||||
from reflex.utils import export as export_utils
|
||||
from reflex.utils import prerequisites
|
||||
|
||||
# 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(),
|
||||
upload_db_file=upload_db_file,
|
||||
),
|
||||
key=key,
|
||||
regions=regions,
|
||||
envs=envs,
|
||||
cpus=cpus,
|
||||
memory_mb=memory_mb,
|
||||
auto_start=auto_start,
|
||||
auto_stop=auto_stop,
|
||||
frontend_hostname=frontend_hostname,
|
||||
interactive=interactive,
|
||||
with_metrics=with_metrics,
|
||||
with_tracing=with_tracing,
|
||||
loglevel=loglevel.subprocess_level(),
|
||||
)
|
||||
|
||||
|
||||
@cli.command()
|
||||
def deployv2(
|
||||
app_name: str = typer.Option(
|
||||
@ -703,7 +530,7 @@ def deployv2(
|
||||
envfile=envfile,
|
||||
hostname=hostname,
|
||||
interactive=interactive,
|
||||
loglevel=loglevel.subprocess_level(),
|
||||
loglevel=type(loglevel).INFO,
|
||||
token=token,
|
||||
project=project,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user