tethysplatform / tethys

The Tethys Platform main Django website project repository.
http://tethysplatform.org/
BSD 2-Clause "Simplified" License
92 stars 49 forks source link

Add Custom Settings to Apps Endpoint of Portal API #1004

Closed swainn closed 7 months ago

swainn commented 7 months ago

Adds the custom settings to the object that is returned when calling the apps endpoint of the Tethys Portal REST API. This makes the custom settings available to apps with the React frontend, which uses the REST API to get info about the app.

Example of object returned with custom settings:

{
  "title": "tRIBS Model Builder",
  "description": "An application for building new tRIBS models for SRP studies.",
  "tags": "",
  "package": "tribs",
  "urlNamespace": "tribs",
  "color": "#115590",
  "icon": "/static/tribs/images/icon.gif",
  "exitUrl": "/apps/",
  "rootUrl": "/apps/tribs/home/home/",
  "settingsUrl": "/admin/tethys_apps/tethysapp/3/change/",
  "customSettings": {
    "cesium_api_key": {
      "type": "STRING",
      "value": "some-api-key"
    },
    "json_setting": {
      "type": "JSON",
      "value": {"foo": "bar"}
    },
    "secret_setting": {
      "type": "SECRET",
      "value": "some-secret"
    }
  }
}

Also in this PR:

coveralls commented 7 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling 896c326cb6c13b0222fc688fb3944320c71cca68 on api-custom-settings into f5cfc0bd8ed348eb28e8b22b1c69858c2c31e4c6 on main.