qwc-services / qwc-config-generator

QWC Config Generator
2 stars 12 forks source link

Template themesConfig.json #68

Closed benoitblanc closed 9 months ago

benoitblanc commented 9 months ago

Hi,

As tenantConfig.json can be templated, this PR proposes to do the same with themesConfig.json.

It could allow admin to create a templateThemesConfig.json in INPUT_CONFIG_PATH where all the common parameters (i.e defaultSearchProviders, backgroundLayers, ...) for each tenant could be written and specific parameters could be in themesConfig.json located in each tenant directory.

For now, this option is not compatible with plugin Themes in qwc-admin-gui. Any suggestion or contribution is welcomed, I am also thinking about it.

Thanks

manisandro commented 9 months ago

I'd proceed as follows:

  1. When reading the tenantConfig.template.json: you can either specify the template themesConfig directly inline in the tenantConfig.template.json, or point to a separate file, in which case this file is read and embedded into the tenantConfig.template.json
  2. When reading the tenantConfig.json: Same as above, you can specify the themesConfig either inline or as a separate file, in which case the contents is embedded into the tenantConfig.json.
  3. Finally, merge the tenantConfig.template.json with the tenantConfig.json

In this way there is no need for a separate templateThemesConfig.json or similar, you can just specify the templated values via tenantConfig.template.json. (Perhaps this actually already works?)

benoitblanc commented 9 months ago

Hi @manisandro

Thanks for your advice. It did not work at the moment so I have force-pushed a commit which should handle this use-case

EDIT: it is still not compatible with Themes plugin in admin GUI

manisandro commented 9 months ago

Thanks, I guess the block [1] is now redundant with this change?

[1] https://github.com/qwc-services/qwc-config-generator/blob/master/src/config_generator/config_generator.py#L204

benoitblanc commented 9 months ago

Thanks, I guess the block [1] is now redundant with this change?

[1] https://github.com/qwc-services/qwc-config-generator/blob/master/src/config_generator/config_generator.py#L204

Yes ! I now read themesConfig before to handle templates.

We still need to get themesConfig from config, as it could be merged with a template.

manisandro commented 9 months ago

Thanks!