Introduction 


In this guide, we are going to explain how the centralized global configuration works, and how to make new configurable global variables.


What is the Global Centralized Configuration of the onesait Platform?


There is a module within the platform that is in charge of managing the global configuration parameters. Its name is onesaitplatform-config-resources.


Its main features are:






The Quasar connector has a global variable for the operation timeout, which is configurable and managed by config-resources service.



The global configuration is stored as a JPA entity. It is a Configuration of the type 'OpenPlatform':

You can have several global configurations, as many as application profiles. For example, we have two configurations, one for 'default' (localhost), and one for 'docker' .


The same applies to Endpoints Configuration, but instead we will use Type EndpointModules.

The config-resources service loads at star-tup the Global and Endpoints configurations with the active profile as environment.

NOTE: Remember that you need at least the 'default' Global OpenPlatform configuration in order for the Platform to start up, otherwise it will not start up. Anyway, do not worry, because basic configurations for default and docker profiles are created when you run the SystemConfigInit app.



How to use the GlobalConfiguration in your spring Components?




Despite being only used for a few variables, you can extend it by following these steps:


Inject with @Autowired the IntegrationResourceService. Assign the value to your variable by accessing the GlobalConfiguration of the platform:

Hot-reloading the Global Configurations


If you want to change any existing variable held by the Global Configuration without restarting the modules/containers, you want to go to '/controlpanel/configurations/list' and click on the 'Reload OP configurations'. Doing this, Endpoints and Global Configuration values will be reloaded and updated.




How to use the EndpointsConfiguration in your spring Components?


In the same way, you can change the Endpoints configuration. There is also one for each application profile. The main difference with the GlobalConfiguration is that the yaml tree is fully mapped in the Java domain, so if you want to add endpoints to the Configuration, you will have to create/update all Java classes. For example, having this configuration:



If you want to add 'advice' to 'domain' node (which actually would not make sense), you will have to update the Domain class in 'com.minsait.onesait.platform.config.components', and add the 'advice' attribute:



On the other hand, if you want to add a child node to 'urls', you will have to create a new Java Class and reference it in Urls.java. For example, if you want to add module 'rtdbmaintainer' to the Endpoints configuration you will have to: