govuk-prototype-kit icon indicating copy to clipboard operation
govuk-prototype-kit copied to clipboard

Allow plugins to use config in config.js

Open tomyems opened this issue 1 year ago • 1 comments

Context

In writing a plugin, I'd like to be able to change the behaviour of the plugin based on the config in config.js.

For example, I'd like to turn on/off logging the session data in the terminal.

This needs to be safe against other plugins so, namespaced something like:

{
  "serviceName": "abc",
  "pluginConfig": {
    "govuk-frontend": {
      "globalStyles": false
    },
    "home-office-kit": {
      "logData": true
    }
  }
}

Alternatives

Not currently using a workaround.

Additional information (if applicable)

This will make it easier for plugins to try new features and functionality.

Done when

  • [ ] We have designed the API user experience
  • [ ] The API user experience is approved within the team
  • [ ] A plugin developer can access the config relevant to their plugin

tomyems avatar May 02 '23 08:05 tomyems

I've implemented something that is like the functionality that I'm looking for: https://github.com/UKHomeOffice/home-office-kit/blob/main/routes/all.js in the Home Office kit

tomyems avatar Jun 08 '23 14:06 tomyems