diff --git a/.env b/.env index a550016..4db5e2c 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ SOURCE_FILE=./resources/samples/input4_LatLon.pickle # development settings -CONFIGURATION_FILE=./app-configuration.json \ No newline at end of file +CONFIGURATION_FILE=./app-configuration.json +PRINT_CONFIGURATION=yes \ No newline at end of file diff --git a/CHANGELOG_SDK.md b/CHANGELOG_SDK.md index b3c1db1..850d7b0 100644 --- a/CHANGELOG_SDK.md +++ b/CHANGELOG_SDK.md @@ -1,15 +1,20 @@ # Changelog SDK +## 2025-07 `v2.3.0` + +- introduce app-setting-type `SECRET` + ## 2024-xx + - addition of examples in app.py of importing functions from other .py files, creating artifacts, translating result back to a TrajectoryCollection ## 2024-09 `v2.2.1` - exchange samples: generated by next MoveApps move2 to movingpandas translator app -## 2024-09 `v2.2.0` +## 2024-09 `v2.2.1` -- switch build from `micromamba` to `miniforge3` +- switch build from `micromamba` to [miniforge](https://github.com/conda-forge/miniforge) ## 2024-03 `v2.1.0` diff --git a/developer_README.md b/developer_README.md index 992b451..b5a3a28 100644 --- a/developer_README.md +++ b/developer_README.md @@ -33,6 +33,8 @@ Critical parts of the SDK can be adjusted by `environment variables`. Keep in mi - `SOURCE_FILE`: path to the input file for your App. - `CONFIGURATION_FILE`: path to the configuration/settings file of your App (in [JSON](https://www.w3schools.com/js/js_json_intro.asp) format - must correspondent with the `settings` of your `appspec.json`, see [MoveApps parameters](https://docs.moveapps.org/#/copilot-python-sdk.md#moveapps-parameters) for an example of the `app-configuration.json` file). +- `PRINT_CONFIGURATION`: prints the configuration your App receives (`yes|no`) +- `MASK_SETTING_IDS`: A comma-separated list of setting IDs whose values will be hidden in the SDK logs You can adjust these environment variables by adjusting the file `./.env`. diff --git a/sdk/moveapps_execution.py b/sdk/moveapps_execution.py index b915bcb..4d0f854 100644 --- a/sdk/moveapps_execution.py +++ b/sdk/moveapps_execution.py @@ -59,10 +59,22 @@ def __load_config(): else: config = os.environ.get('CONFIGURATION', '{}') parsed = json.loads(config) + if os.environ.get("PRINT_CONFIGURATION", "no") == "yes": - logging.info(f'app will be started with configuration: {parsed}') + # Create a copy of parsed for logging + logging_config = parsed.copy() + # Get and process MASK_SETTING_IDS + mask_setting_ids = os.environ.get('MASK_SETTING_IDS', '').strip() + if mask_setting_ids: + # Split by comma and trim each value + mask_keys = [key.strip() for key in mask_setting_ids.split(',')] + # Replace values with "***masked***" for specified keys in the logging copy + for key in mask_keys: + if key in logging_config: + logging_config[key] = "***masked***" + logging.info(f'app will be started with configuration: {logging_config}') return parsed - + def __store_output(self, data): logging.info(f'storing output: {data}') pd.to_pickle(data, self.env.output_file) @@ -74,4 +86,4 @@ def __store_error(self, error: Exception): def __call_app(self, data): outputs = self._pm.hook.execute(data=data, config=self.env.app_configuration) - return outputs[0] + return outputs[0] \ No newline at end of file