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:
parent
8de14d4384
commit
db13fe65b8
@ -306,6 +306,9 @@ def export(
|
|||||||
help="Whether to exclude sqlite db files when exporting backend.",
|
help="Whether to exclude sqlite db files when exporting backend.",
|
||||||
hidden=True,
|
hidden=True,
|
||||||
),
|
),
|
||||||
|
env: constants.Env = typer.Option(
|
||||||
|
constants.Env.PROD, help="The environment to export the app in."
|
||||||
|
),
|
||||||
loglevel: constants.LogLevel = typer.Option(
|
loglevel: constants.LogLevel = typer.Option(
|
||||||
config.loglevel, help="The log level to use."
|
config.loglevel, help="The log level to use."
|
||||||
),
|
),
|
||||||
@ -323,6 +326,7 @@ def export(
|
|||||||
backend=backend,
|
backend=backend,
|
||||||
zip_dest_dir=zip_dest_dir,
|
zip_dest_dir=zip_dest_dir,
|
||||||
upload_db_file=upload_db_file,
|
upload_db_file=upload_db_file,
|
||||||
|
env=env,
|
||||||
loglevel=loglevel.subprocess_level(),
|
loglevel=loglevel.subprocess_level(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -933,6 +933,7 @@ class AppHarnessProd(AppHarness):
|
|||||||
frontend=True,
|
frontend=True,
|
||||||
backend=False,
|
backend=False,
|
||||||
loglevel=reflex.constants.LogLevel.INFO,
|
loglevel=reflex.constants.LogLevel.INFO,
|
||||||
|
env=reflex.constants.Env.PROD,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.frontend_thread = threading.Thread(target=self._run_frontend)
|
self.frontend_thread = threading.Thread(target=self._run_frontend)
|
||||||
|
@ -4,7 +4,7 @@ from pathlib import Path
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from reflex import constants
|
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
|
from reflex.utils import build, console, exec, prerequisites, telemetry
|
||||||
|
|
||||||
config = get_config()
|
config = get_config()
|
||||||
@ -18,6 +18,7 @@ def export(
|
|||||||
upload_db_file: bool = False,
|
upload_db_file: bool = False,
|
||||||
api_url: Optional[str] = None,
|
api_url: Optional[str] = None,
|
||||||
deploy_url: Optional[str] = None,
|
deploy_url: Optional[str] = None,
|
||||||
|
env: constants.Env = constants.Env.PROD,
|
||||||
loglevel: constants.LogLevel = console._LOG_LEVEL,
|
loglevel: constants.LogLevel = console._LOG_LEVEL,
|
||||||
):
|
):
|
||||||
"""Export the app to a zip file.
|
"""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.
|
upload_db_file: Whether to upload the database file. Defaults to False.
|
||||||
api_url: The API URL to use. Defaults to None.
|
api_url: The API URL to use. Defaults to None.
|
||||||
deploy_url: The deploy 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.
|
loglevel: The log level to use. Defaults to console._LOG_LEVEL.
|
||||||
"""
|
"""
|
||||||
# Set the log level.
|
# Set the log level.
|
||||||
console.set_log_level(loglevel)
|
console.set_log_level(loglevel)
|
||||||
|
|
||||||
|
# Set env mode in the environment
|
||||||
|
environment.REFLEX_ENV_MODE.set(env)
|
||||||
|
|
||||||
# Override the config url values if provided.
|
# Override the config url values if provided.
|
||||||
if api_url is not None:
|
if api_url is not None:
|
||||||
config.api_url = str(api_url)
|
config.api_url = str(api_url)
|
||||||
|
Loading…
Reference in New Issue
Block a user