Skip to main content
Version: 1.16

Import/Export service configuration

Many REGARDS microservices provide a REST API to import and export configuration in Json format.

REST API

How to

The Regards REST API concept describes how REST interfaces must be handled to submit requests.

caution

The easiest way to use the import/export configuration system is to first download the configuration file of the wanted microservice rather than trying to write it from scratch. The configuration file format is pretty hard to understand from scratch.

Endpoint

EndpointVerbDescription
/microservice/configurationPOSTExport configuration by providing a json file
/microservice/configurationGETImport configuration by downloading a json file
info

By default these endpoints are only available to project administrators.

Parameters

For Export, add your file in a multipart request using the name file.

Example of curl request to import configuration
curl https://regards.fr/api/v1/rs-dam/microservice/configuration  \
--form file='@/home/myuser/tmp/rs-dam-configuration.json' \
-H 'Authorization: Bearer <token>'

Configuration file format

Configuration files have the same format for all microservice.
It describes the configuration for every Module of the microservice.

Here's a simple example of the basic structure of this file :

{
"microservice": "rs-notifier",
"modules": [
{
"module": {
"id": "notifier"
},
"resetBeforeImport": true,
"configuration": [
...
]
}
]
}

In each module, you have to provide two parameters.

ParameterTypeDescription
resetBeforeImportBooleanIndicates if the previous module configuration should be deleted before importing the new one.
configurationObjectModule specific format configuration
info

If the resetBeforeImport is set to false, the microservice will try to merge the previous and new configurations.

The Configuration section may contain two common types of configuration :

  • Settings : Parameters with custom values
  • Plugins configurations : Specific format for plugins to define their configuration

A microservice can also provide custom configuration parameters in this configuration file.
For information on those parameters, please refer to the microservice configuration section of documentation.

Settings configuration section

Each setting parameter section start with key :

fr.cnes.regards.framework.modules.tenant.settings.domain.DynamicTenantSetting

The value contains information about the settings with the parameters listed below :

ParameterTypeShould be editedDescription
nameStringNoName of the setting
descriptionStringNoSimple description of the setting purpose
valueStringYesSerialized value of the setting
defaultValueStringNoSerialized default value of the setting (used if value is not provided)
classNameStringNoJava class name used to deserialize setting value
containsSensitiveParametersBooleanNoIndicates if setting value should be encrypted in DataBase
DynamicTenantSetting example
{
"key": "fr.cnes.regards.framework.modules.tenant.settings.domain.DynamicTenantSetting",
"value": {
"name": "setting_name",
"description": "setting description",
"value": "\"value\"",
"defaultValue": "\"default\"",
"className": "java.lang.String",
"containsSensitiveParameters": false
}
},

Plugin configuration section

Each setting parameter section start with key:

fr.cnes.regards.framework.modules.plugins.domain.PluginConfiguration

The value contains information about the settings with the parameters listed below :

ParameterTypeCan be editedDescription
pluginIdStringNoPlugin unique identifier
businessIdStringYesConfiguration unique identifier
labelStringYesConfiguration label (displayed in admin UI)
versionStringNoConfiguration version
priorityOrderIntegerYesPriority of the configuration.
Can be used by service if there are more than one configuration for a plugin.
activeBooleanYesTrue to activate the configuration.
If false, service will not be allowed to use this configuration.
parametersList<Parameter\>YesPlugin configuration specific parameters

The parameters section contains a list of formated parameters. Parameters depends on the plugin you want to configure and include :

ParameterTypeDescription
nameStringPlugin parameter name
typeStringPlugin parameter TYPE can be
STRING, BYTE, SHORT, INTEGER, LONG, FLOAT,
DOUBLE, BOOLEAN, MAP, COLLECTION, POJO, PLUGIN and REGARDS_ENTITY_MODEL
valueObjectValue of the parameter depending on previous type attribute.
dynamicBooleanIndicates if the parameter value can be provided at plugin runtime or if it is a static configuration value
info

If a plugin parameter is configured to be dynamic, then the value will be requested at runtime if the service allows it In order to know parameters that can be set as dynamic, see the microservice plugins documentation.

Example :

{
"key": "fr.cnes.regards.framework.modules.plugins.domain.PluginConfiguration",
"value": {
"pluginId": "DisseminationAckSender",
"label": "Ack dissemination configuration",
"businessId": "ack-conf-001",
"version": "2.0.0",
"priorityOrder": 0,
"active": true,
"parameters": [
{
"name": "recipientLabel",
"type": "STRING",
"value": "regards",
"dynamic": false
},
{
"name": "ackRequired",
"type": "BOOLEAN",
"value": false,
"dynamic": false
}
]
}
}

Response

  • Code: 201 CREATED