Skip to content

Commit 4160ba3

Browse files
authored
🎨 webserver's trash flag (#6850)
1 parent 83a08e7 commit 4160ba3

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

services/web/server/src/simcore_service_webserver/application_settings.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,27 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
271271
WEBSERVER_CLUSTERS: bool = False
272272
WEBSERVER_DB_LISTENER: bool = True
273273
WEBSERVER_FOLDERS: bool = True
274-
WEBSERVER_WORKSPACES: bool = True
275274
WEBSERVER_GROUPS: bool = True
276275
WEBSERVER_META_MODELING: bool = True
277276
WEBSERVER_NOTIFICATIONS: bool = Field(default=True)
278277
WEBSERVER_PRODUCTS: bool = True
278+
WEBSERVER_PROFILING: bool = False
279279
WEBSERVER_PUBLICATIONS: bool = True
280280
WEBSERVER_REMOTE_DEBUG: bool = True
281281
WEBSERVER_SOCKETIO: bool = True
282282
WEBSERVER_TAGS: bool = True
283+
WEBSERVER_TRASH: Annotated[
284+
bool,
285+
Field(
286+
description="Currently only used to enable/disable front-end",
287+
validation_alias=AliasChoices(
288+
"WEBSERVER_TRASH", "WEBSERVER_DEV_FEATURES_ENABLED"
289+
),
290+
),
291+
] = False
283292
WEBSERVER_VERSION_CONTROL: bool = True
284293
WEBSERVER_WALLETS: bool = True
285-
WEBSERVER_PROFILING: bool = False
294+
WEBSERVER_WORKSPACES: bool = True
286295

287296
#
288297
WEBSERVER_SECURITY: bool = Field(
@@ -314,6 +323,7 @@ def build_vcs_release_url_if_unset(cls, values):
314323
# TODO: consider mark as dev-feature in field extras of Config attr.
315324
# Then they can be automtically advertised
316325
"WEBSERVER_META_MODELING",
326+
"WEBSERVER_TRASH",
317327
"WEBSERVER_VERSION_CONTROL",
318328
mode="before",
319329
)
@@ -376,6 +386,7 @@ def _get_disabled_public_plugins(self) -> list[str]:
376386
"WEBSERVER_META_MODELING",
377387
"WEBSERVER_PAYMENTS",
378388
"WEBSERVER_SCICRUNCH",
389+
"WEBSERVER_TRASH",
379390
"WEBSERVER_VERSION_CONTROL",
380391
}
381392
return [_ for _ in public_plugin_candidates if not self.is_enabled(_)]

services/web/server/tests/unit/isolated/test_application_settings.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,25 @@ def test_settings_to_client_statics_plugins(
103103
assert set(statics["pluginsDisabled"]) == (disable_plugins | {"WEBSERVER_CLUSTERS"})
104104

105105

106+
@pytest.mark.parametrize("is_dev_feature_enabled", [True, False])
107+
def test_settings_to_client_statics_for_webserver_trash(
108+
is_dev_feature_enabled: bool,
109+
mock_webserver_service_environment: EnvVarsDict,
110+
monkeypatch: pytest.MonkeyPatch,
111+
):
112+
monkeypatch.setenv(
113+
"WEBSERVER_DEV_FEATURES_ENABLED", f"{is_dev_feature_enabled}".lower()
114+
)
115+
116+
settings = ApplicationSettings.create_from_envs()
117+
statics = settings.to_client_statics()
118+
119+
if is_dev_feature_enabled:
120+
assert "WEBSERVER_TRASH" not in set(statics["pluginsDisabled"])
121+
else:
122+
assert "WEBSERVER_TRASH" in set(statics["pluginsDisabled"])
123+
124+
106125
def test_avoid_sensitive_info_in_public(app_settings: ApplicationSettings):
107126
# avoids display of sensitive info
108127
assert not any("pass" in key for key in app_settings.public_dict())

0 commit comments

Comments
 (0)