Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 webserver's trash flag #6850

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,27 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
WEBSERVER_CLUSTERS: bool = False
WEBSERVER_DB_LISTENER: bool = True
WEBSERVER_FOLDERS: bool = True
WEBSERVER_WORKSPACES: bool = True
WEBSERVER_GROUPS: bool = True
WEBSERVER_META_MODELING: bool = True
WEBSERVER_NOTIFICATIONS: bool = Field(default=True)
WEBSERVER_PRODUCTS: bool = True
WEBSERVER_PROFILING: bool = False
WEBSERVER_PUBLICATIONS: bool = True
WEBSERVER_REMOTE_DEBUG: bool = True
WEBSERVER_SOCKETIO: bool = True
WEBSERVER_TAGS: bool = True
WEBSERVER_TRASH: Annotated[
bool,
Field(
description="Currently only used to enable/disable front-end",
validation_alias=AliasChoices(
"WEBSERVER_TRASH", "WEBSERVER_DEV_FEATURES_ENABLED"
),
),
] = False
WEBSERVER_VERSION_CONTROL: bool = True
WEBSERVER_WALLETS: bool = True
WEBSERVER_PROFILING: bool = False
WEBSERVER_WORKSPACES: bool = True

#
WEBSERVER_SECURITY: bool = Field(
Expand Down Expand Up @@ -314,6 +323,7 @@ def build_vcs_release_url_if_unset(cls, values):
# TODO: consider mark as dev-feature in field extras of Config attr.
# Then they can be automtically advertised
"WEBSERVER_META_MODELING",
"WEBSERVER_TRASH",
"WEBSERVER_VERSION_CONTROL",
mode="before",
)
Expand Down Expand Up @@ -376,6 +386,7 @@ def _get_disabled_public_plugins(self) -> list[str]:
"WEBSERVER_META_MODELING",
"WEBSERVER_PAYMENTS",
"WEBSERVER_SCICRUNCH",
"WEBSERVER_TRASH",
"WEBSERVER_VERSION_CONTROL",
}
return [_ for _ in public_plugin_candidates if not self.is_enabled(_)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ def test_settings_to_client_statics_plugins(
assert set(statics["pluginsDisabled"]) == (disable_plugins | {"WEBSERVER_CLUSTERS"})


@pytest.mark.parametrize("is_dev_feature_enabled", [True, False])
def test_settings_to_client_statics_for_webserver_trash(
is_dev_feature_enabled: bool,
mock_webserver_service_environment: EnvVarsDict,
monkeypatch: pytest.MonkeyPatch,
):
monkeypatch.setenv(
"WEBSERVER_DEV_FEATURES_ENABLED", f"{is_dev_feature_enabled}".lower()
)

settings = ApplicationSettings.create_from_envs()
statics = settings.to_client_statics()

if is_dev_feature_enabled:
assert "WEBSERVER_TRASH" not in set(statics["pluginsDisabled"])
else:
assert "WEBSERVER_TRASH" in set(statics["pluginsDisabled"])


def test_avoid_sensitive_info_in_public(app_settings: ApplicationSettings):
# avoids display of sensitive info
assert not any("pass" in key for key in app_settings.public_dict())
Expand Down
Loading