add help link for show_built_with_reflex option

This commit is contained in:
Masen Furer 2025-01-30 16:36:57 -08:00
parent 44ce7d134c
commit 8df1890e7d
No known key found for this signature in database
GPG Key ID: 2AE2BD5531FF94F4
2 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,8 @@ except TypeError:
# Fallback for older typer versions.
cli = typer.Typer(add_completion=False)
SHOW_BUILT_WITH_REFLEX_INFO = "https://reflex.dev/docs/hosting/reflex-branding/"
# Get the config.
config = get_config()
@ -188,6 +190,7 @@ def _run(
option_name="show_built_with_reflex",
allowed_tiers=["team", "enterprise"],
fallback_value=True,
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
)
# Get the app module.
@ -334,6 +337,7 @@ def export(
option_name="show_built_with_reflex",
allowed_tiers=["team", "enterprise"],
fallback_value=False,
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
)
export_utils.export(
@ -536,6 +540,7 @@ def deploy(
option_name="show_built_with_reflex",
allowed_tiers=["pro", "team", "enterprise"],
fallback_value=True,
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
)
# Set the log level.

View File

@ -1984,6 +1984,7 @@ def check_config_option_in_tier(
option_name: str,
allowed_tiers: list[str],
fallback_value: Any,
help_link: str | None = None
):
"""Check if a config option is allowed for the authenticated user's current tier.
@ -1991,6 +1992,7 @@ def check_config_option_in_tier(
option_name: The name of the option to check.
allowed_tiers: The tiers that are allowed to use the option.
fallback_value: The fallback value if the option is not allowed.
help_link: The help link to show to a user that is authenticated.
"""
from reflex_cli.v2.utils import hosting
@ -2005,8 +2007,10 @@ def check_config_option_in_tier(
current_tier = authenticated_token[1].get("tier", "").lower()
the_remedy = (
f"Your current subscription tier is `{current_tier}`. "
f"Please upgrade to {allowed_tiers} to access this option."
f"Please upgrade to {allowed_tiers} to access this option. "
)
if help_link:
the_remedy += f"See {help_link} for more information."
if current_tier not in allowed_tiers:
console.warn(f"Config option `{option_name}` is restricted. {the_remedy}")
setattr(config, option_name, fallback_value)