reflex export environment should default to prod

This commit is contained in:
Khaleel Al-Adhami 2025-01-21 15:41:29 -08:00
parent 048416163d
commit 284e58a90c
2 changed files with 10 additions and 1 deletions

View File

@ -306,6 +306,9 @@ def export(
help="Whether to exclude sqlite db files when exporting backend.",
hidden=True,
),
env: constants.Env = typer.Option(
constants.Env.PROD, help="The environment to run the app in."
),
loglevel: constants.LogLevel = typer.Option(
config.loglevel, help="The log level to use."
),
@ -323,6 +326,7 @@ def export(
backend=backend,
zip_dest_dir=zip_dest_dir,
upload_db_file=upload_db_file,
env=env,
loglevel=loglevel.subprocess_level(),
)

View File

@ -4,7 +4,7 @@ from pathlib import Path
from typing import Optional
from reflex import constants
from reflex.config import get_config
from reflex.config import environment, get_config
from reflex.utils import build, console, exec, prerequisites, telemetry
config = get_config()
@ -18,6 +18,7 @@ def export(
upload_db_file: bool = False,
api_url: Optional[str] = None,
deploy_url: Optional[str] = None,
env: constants.Env = constants.Env.PROD,
loglevel: constants.LogLevel = console._LOG_LEVEL,
):
"""Export the app to a zip file.
@ -30,11 +31,15 @@ def export(
upload_db_file: Whether to upload the database file. Defaults to False.
api_url: The API URL to use. Defaults to None.
deploy_url: The deploy URL to use. Defaults to None.
env: The environment to use. Defaults to constants.Env.PROD.
loglevel: The log level to use. Defaults to console._LOG_LEVEL.
"""
# Set the log level.
console.set_log_level(loglevel)
# Set env mode in the environment
environment.REFLEX_ENV_MODE.set(constants.Env.PROD)
# Override the config url values if provided.
if api_url is not None:
config.api_url = str(api_url)