Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Externalize overrides for localConfig.json #3688

Closed
offtherailz opened this issue Apr 12, 2019 · 2 comments
Closed

Externalize overrides for localConfig.json #3688

offtherailz opened this issue Apr 12, 2019 · 2 comments

Comments

@offtherailz
Copy link
Member

offtherailz commented Apr 12, 2019

Description

Actually MapStore has no way to externalize configurations for localConfig.json.
The server where MapStore is installed may need specific configurations (e.g. auth rules, catalog services, cors settings, specific URLs).
To do this setting the localConfig.json must be edited. This has a series of cons:

  • Any update of the application will reset the changes
  • versioning of localConfig.json should be platform indipendent.

To allow externalization/customization we (me and @mbarto ) propose the following:

  • MapStore should load 2 files instead of one:
    • localConfig.json
    • configOverrides.json
  • configOverrides.json contains the changes to apply to localConfig.json and is added to the project, empty by default.
  • The configOverrides.json file path can be intercepted by the MS back-end, if a env MS_CONFIG_OVERRIDES_FILE is defined. If so, the back-end will provide the external file instead of the local one.

configOverrides.json definition

This file should allow to apply simple changes to the localConfig.json.

Typical attributes to override are:

  • root variables (printUrl, geoStoreUrl, bingApiKey, mapquestApiKey....)
  • authenticationRules array of rules.
  • initialState allow to configure the initial state of the application (e.g. initialState.defaultState.catalog.default.Services
  • plugins: arrays of plugin configs (strings or object)
plugins: {
desktop: ["PluginName1", {name:"PluginName2", cfg: {someattribute: "someValue}]
}

configOverrides.json entries should allow to override all the properties.

One of the existing languages is:

JSON Patch

One way to express the changes can be JSON Patch RFC6902. There are many implementation in many languages (now we are interested only to JavaScript of course).
This language allow to do insert, update, delete, replace operations on a JSON.

Limitations of JSON Patch

Typically the overrides could be some changes to the plugins configuration.
The current plugin configuration look like this:

This mean that we may need to find the plugin (that can be expressed as string or object) and replace/add some configuration). The index of the element in the array may cange, and I didn't find any kind of "find and replace" functionality in jsonpatch.

So we may need to do a custom technique to replace configurations in array that supports some kind of search and replace rule.
An alternative is to add a series of "test" rules before to override elements, to prevent issues due to array shift (insert of new plugins). If test fail, the client should send a message to notify the problem.

This issue is somehow related to #3117 because a general cleanup is useful to define better what to override.

@offtherailz offtherailz added this to the 2019.02.00 milestone Apr 12, 2019
offtherailz pushed a commit that referenced this issue Apr 12, 2019
Integration between mapstore and geoserver gs-stable. Waiting f for ovverride functionalities in #3688
@tdipisa tdipisa added the backlog label May 3, 2019
@tdipisa
Copy link
Member

tdipisa commented May 6, 2019

@offtherailz, @mbarto please, can you provide an estimate for this issue? I think that could be the case to define a MS data directory since it can be useful also for other custom resources (custom annotation SVG symbols, geostory default images etc.) that can be externalized without impacting on the MS deploy.

@tdipisa tdipisa closed this as completed Jul 1, 2020
@tdipisa tdipisa modified the milestones: 2020.02.01, 2020.02.00 Jul 1, 2020
mbarto added a commit to mbarto/MapStore2 that referenced this issue Jul 8, 2020
…ally loaded configuration files (geosolutions-it#5266)

# Conflicts:
#	backend/src/main/java/it/geosolutions/mapstore/UploadPluginController.java
#	backend/src/test/java/it/geosolutions/mapstore/UploadPluginControllerTest.java
@MV88 MV88 reopened this Jul 8, 2020
MV88 pushed a commit that referenced this issue Jul 8, 2020
…figuration files (#5266) (#5609)

json-patch format overrides support for dynamically loaded configuration files
# Conflicts:
#	backend/src/main/java/it/geosolutions/mapstore/UploadPluginController.java
#	backend/src/test/java/it/geosolutions/mapstore/UploadPluginControllerTest.java
@MV88
Copy link
Contributor

MV88 commented Jul 8, 2020

@ElenaGallo this is non testable in QA

@MV88 MV88 closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants