Skip to content

Commit 00a1f4c

Browse files
committed
add warning about the env vars
1 parent e71a257 commit 00a1f4c

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

reflex/app.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,17 @@ def _add_optional_endpoints(self):
686686
)
687687
if environment.REFLEX_ADD_ALL_ROUTES_ENDPOINT.get():
688688
self.add_all_routes_endpoint()
689-
if environment.REFLEX_ADD_ACTIVE_CONNECTIONS_ENDPOINT.get():
689+
if environment.REFLEX_INSECURE_ADD_ACTIVE_CONNECTIONS_ENDPOINT.get():
690+
console.warn(
691+
f"The `{environment.REFLEX_INSECURE_ADD_ACTIVE_CONNECTIONS_ENDPOINT.name}` environment variable is set to True. "
692+
"This endpoint is insecure and should not be used in production."
693+
)
690694
self.add_active_connections_endpoint()
691-
if environment.REFLEX_ADD_CLONE_STATE_ENDPOINT.get():
695+
if environment.REFLEX_INSECURE_ADD_CLONE_STATE_ENDPOINT.get():
696+
console.warn(
697+
f"The `{environment.REFLEX_INSECURE_ADD_CLONE_STATE_ENDPOINT.name}` environment variable is set to True. "
698+
"This endpoint is insecure and should not be used in production."
699+
)
692700
self.add_clone_state_endpoint()
693701

694702
@staticmethod
@@ -1556,7 +1564,7 @@ async def clone_state(request: Request) -> Response:
15561564
found_new = True
15571565

15581566
await self.state_manager.set_state(
1559-
new_token + "_" + new_state.get_full_name(), new_state
1567+
_substate_key(new_token, new_state), new_state
15601568
)
15611569

15621570
return JSONResponse(new_token)

reflex/environment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,10 @@ class EnvironmentVariables:
618618
REFLEX_ADD_ALL_ROUTES_ENDPOINT: EnvVar[bool] = env_var(False)
619619

620620
# Used by flexgen to list all active connections.
621-
REFLEX_ADD_ACTIVE_CONNECTIONS_ENDPOINT: EnvVar[bool] = env_var(False)
621+
REFLEX_INSECURE_ADD_ACTIVE_CONNECTIONS_ENDPOINT: EnvVar[bool] = env_var(False)
622622

623623
# Used by flexgen to clone the state of the app.
624-
REFLEX_ADD_CLONE_STATE_ENDPOINT: EnvVar[bool] = env_var(False)
624+
REFLEX_INSECURE_ADD_CLONE_STATE_ENDPOINT: EnvVar[bool] = env_var(False)
625625

626626
# The address to bind the HTTP client to. You can set this to "::" to enable IPv6.
627627
REFLEX_HTTP_CLIENT_BIND_ADDRESS: EnvVar[str | None] = env_var(None)

0 commit comments

Comments
 (0)