reflex export environment should default to prod (#4673)

* reflex export environment should default to prod

* what

* wat

* what is this silly goose
This commit is contained in:
Khaleel Al-Adhami 2025-01-22 11:11:47 -08:00 committed by GitHub
parent 8de14d4384
commit db13fe65b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 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 export 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

@ -933,6 +933,7 @@ class AppHarnessProd(AppHarness):
frontend=True,
backend=False,
loglevel=reflex.constants.LogLevel.INFO,
env=reflex.constants.Env.PROD,
)
self.frontend_thread = threading.Thread(target=self._run_frontend)

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(env)
# Override the config url values if provided.
if api_url is not None:
config.api_url = str(api_url)