diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index 511554e185e..e5aa008377a 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -280,15 +280,6 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings): 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_WORKSPACES: bool = True @@ -302,7 +293,7 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings): @model_validator(mode="before") @classmethod - def build_vcs_release_url_if_unset(cls, values): + def _build_vcs_release_url_if_unset(cls, values): release_url = values.get("SIMCORE_VCS_RELEASE_URL") if release_url is None and ( @@ -323,12 +314,11 @@ 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", ) @classmethod - def enable_only_if_dev_features_allowed(cls, v, info: ValidationInfo): + def _enable_only_if_dev_features_allowed(cls, v, info: ValidationInfo): """Ensures that plugins 'under development' get programatically disabled if WEBSERVER_DEV_FEATURES_ENABLED=False """ @@ -345,19 +335,14 @@ def enable_only_if_dev_features_allowed(cls, v, info: ValidationInfo): else False ) - @cached_property - def log_level(self) -> int: - level: int = getattr(logging, self.WEBSERVER_LOGLEVEL.upper()) - return level - @field_validator("WEBSERVER_LOGLEVEL") @classmethod - def valid_log_level(cls, value): + def _valid_log_level(cls, value): return cls.validate_log_level(value) @field_validator("SC_HEALTHCHECK_TIMEOUT", mode="before") @classmethod - def get_healthcheck_timeout_in_seconds(cls, v): + def _get_healthcheck_timeout_in_seconds(cls, v): # Ex. HEALTHCHECK --interval=5m --timeout=3s if isinstance(v, str): factor = 1 # defaults on s @@ -371,6 +356,11 @@ def get_healthcheck_timeout_in_seconds(cls, v): # HELPERS -------------------------------------------------------- + @cached_property + def log_level(self) -> int: + level: int = getattr(logging, self.WEBSERVER_LOGLEVEL.upper()) + return level + def is_enabled(self, field_name: str) -> bool: return bool(getattr(self, field_name, None)) @@ -386,7 +376,6 @@ 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(_)] diff --git a/services/web/server/tests/unit/isolated/test_application_settings.py b/services/web/server/tests/unit/isolated/test_application_settings.py index 43f4a366197..a255a2c0a3a 100644 --- a/services/web/server/tests/unit/isolated/test_application_settings.py +++ b/services/web/server/tests/unit/isolated/test_application_settings.py @@ -104,10 +104,16 @@ def test_settings_to_client_statics_plugins( @pytest.mark.parametrize("is_dev_feature_enabled", [True, False]) -def test_settings_to_client_statics_for_webserver_trash( +@pytest.mark.parametrize( + "plugin_name", + ["WEBSERVER_META_MODELING", "WEBSERVER_VERSION_CONTROL", "WEBSERVER_CLUSTERS"] + # NOTE: this is the list in _enable_only_if_dev_features_allowed +) +def test_disabled_plugins_settings_to_client_statics( is_dev_feature_enabled: bool, mock_webserver_service_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch, + plugin_name: str, ): monkeypatch.setenv( "WEBSERVER_DEV_FEATURES_ENABLED", f"{is_dev_feature_enabled}".lower() @@ -116,10 +122,11 @@ def test_settings_to_client_statics_for_webserver_trash( settings = ApplicationSettings.create_from_envs() statics = settings.to_client_statics() + # checks whether it is shown to the front-end depending on the value of WEBSERVER_DEV_FEATURES_ENABLED if is_dev_feature_enabled: - assert "WEBSERVER_TRASH" not in set(statics["pluginsDisabled"]) + assert plugin_name not in set(statics["pluginsDisabled"]) else: - assert "WEBSERVER_TRASH" in set(statics["pluginsDisabled"]) + assert plugin_name in set(statics["pluginsDisabled"]) def test_avoid_sensitive_info_in_public(app_settings: ApplicationSettings):