add help link for show_built_with_reflex option
This commit is contained in:
parent
44ce7d134c
commit
8df1890e7d
@ -26,6 +26,8 @@ except TypeError:
|
|||||||
# Fallback for older typer versions.
|
# Fallback for older typer versions.
|
||||||
cli = typer.Typer(add_completion=False)
|
cli = typer.Typer(add_completion=False)
|
||||||
|
|
||||||
|
SHOW_BUILT_WITH_REFLEX_INFO = "https://reflex.dev/docs/hosting/reflex-branding/"
|
||||||
|
|
||||||
# Get the config.
|
# Get the config.
|
||||||
config = get_config()
|
config = get_config()
|
||||||
|
|
||||||
@ -188,6 +190,7 @@ def _run(
|
|||||||
option_name="show_built_with_reflex",
|
option_name="show_built_with_reflex",
|
||||||
allowed_tiers=["team", "enterprise"],
|
allowed_tiers=["team", "enterprise"],
|
||||||
fallback_value=True,
|
fallback_value=True,
|
||||||
|
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get the app module.
|
# Get the app module.
|
||||||
@ -334,6 +337,7 @@ def export(
|
|||||||
option_name="show_built_with_reflex",
|
option_name="show_built_with_reflex",
|
||||||
allowed_tiers=["team", "enterprise"],
|
allowed_tiers=["team", "enterprise"],
|
||||||
fallback_value=False,
|
fallback_value=False,
|
||||||
|
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
|
||||||
)
|
)
|
||||||
|
|
||||||
export_utils.export(
|
export_utils.export(
|
||||||
@ -536,6 +540,7 @@ def deploy(
|
|||||||
option_name="show_built_with_reflex",
|
option_name="show_built_with_reflex",
|
||||||
allowed_tiers=["pro", "team", "enterprise"],
|
allowed_tiers=["pro", "team", "enterprise"],
|
||||||
fallback_value=True,
|
fallback_value=True,
|
||||||
|
help_link=SHOW_BUILT_WITH_REFLEX_INFO,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set the log level.
|
# Set the log level.
|
||||||
|
@ -1984,6 +1984,7 @@ def check_config_option_in_tier(
|
|||||||
option_name: str,
|
option_name: str,
|
||||||
allowed_tiers: list[str],
|
allowed_tiers: list[str],
|
||||||
fallback_value: Any,
|
fallback_value: Any,
|
||||||
|
help_link: str | None = None
|
||||||
):
|
):
|
||||||
"""Check if a config option is allowed for the authenticated user's current tier.
|
"""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.
|
option_name: The name of the option to check.
|
||||||
allowed_tiers: The tiers that are allowed to use the option.
|
allowed_tiers: The tiers that are allowed to use the option.
|
||||||
fallback_value: The fallback value if the option is not allowed.
|
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
|
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()
|
current_tier = authenticated_token[1].get("tier", "").lower()
|
||||||
the_remedy = (
|
the_remedy = (
|
||||||
f"Your current subscription tier is `{current_tier}`. "
|
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:
|
if current_tier not in allowed_tiers:
|
||||||
console.warn(f"Config option `{option_name}` is restricted. {the_remedy}")
|
console.warn(f"Config option `{option_name}` is restricted. {the_remedy}")
|
||||||
setattr(config, option_name, fallback_value)
|
setattr(config, option_name, fallback_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user