Skip to content

Commit db13fe6

Browse files
authored
reflex export environment should default to prod (#4673)
* reflex export environment should default to prod * what * wat * what is this silly goose
1 parent 8de14d4 commit db13fe6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

reflex/reflex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ def export(
306306
help="Whether to exclude sqlite db files when exporting backend.",
307307
hidden=True,
308308
),
309+
env: constants.Env = typer.Option(
310+
constants.Env.PROD, help="The environment to export the app in."
311+
),
309312
loglevel: constants.LogLevel = typer.Option(
310313
config.loglevel, help="The log level to use."
311314
),
@@ -323,6 +326,7 @@ def export(
323326
backend=backend,
324327
zip_dest_dir=zip_dest_dir,
325328
upload_db_file=upload_db_file,
329+
env=env,
326330
loglevel=loglevel.subprocess_level(),
327331
)
328332

reflex/testing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ def _start_frontend(self):
933933
frontend=True,
934934
backend=False,
935935
loglevel=reflex.constants.LogLevel.INFO,
936+
env=reflex.constants.Env.PROD,
936937
)
937938

938939
self.frontend_thread = threading.Thread(target=self._run_frontend)

reflex/utils/export.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Optional
55

66
from reflex import constants
7-
from reflex.config import get_config
7+
from reflex.config import environment, get_config
88
from reflex.utils import build, console, exec, prerequisites, telemetry
99

1010
config = get_config()
@@ -18,6 +18,7 @@ def export(
1818
upload_db_file: bool = False,
1919
api_url: Optional[str] = None,
2020
deploy_url: Optional[str] = None,
21+
env: constants.Env = constants.Env.PROD,
2122
loglevel: constants.LogLevel = console._LOG_LEVEL,
2223
):
2324
"""Export the app to a zip file.
@@ -30,11 +31,15 @@ def export(
3031
upload_db_file: Whether to upload the database file. Defaults to False.
3132
api_url: The API URL to use. Defaults to None.
3233
deploy_url: The deploy URL to use. Defaults to None.
34+
env: The environment to use. Defaults to constants.Env.PROD.
3335
loglevel: The log level to use. Defaults to console._LOG_LEVEL.
3436
"""
3537
# Set the log level.
3638
console.set_log_level(loglevel)
3739

40+
# Set env mode in the environment
41+
environment.REFLEX_ENV_MODE.set(env)
42+
3843
# Override the config url values if provided.
3944
if api_url is not None:
4045
config.api_url = str(api_url)

0 commit comments

Comments
 (0)