---
title: "What is Centralized Configuration?"
canonical: "https://onesaitplatform.refined.site/space/DOCT/2221606401/What%20is%20Centralized%20Configuration%3F"
format: markdown
---
> Macro (toc)

> ℹ️ Available from Release **2.3.0-immortal**

# Introduction

In Q4 the [Centralized Configuration](https://onesaitplatform.atlassian.net/wiki/spaces/DOCT/pages/2221606170) has been remodeled, starting with version **2.3.0** we will find the various changes.

# Changes introduced

## New location

The location of this functionality within the Controlpanel menu will be changed, as it will now **be available to all users**, not just administrators. 

From the next version of the Platform you will find this functionality in **DEV TOOLS**

![image](media://96588475-494e-4c6a-b065-44a4a31bf2d0)

## Named and APIs

As of this version, a readable identifier can be assigned to each configuration, which will allow to operate with the configurations more easily. For this, a **new API** has also been created within the control panel's APIs to be able to obtain a Configuration according to its identifier, type and environment:

![image](media://373e23d1-e541-44cd-9124-0ff03b291a05)

## Integration with microservices

In addition, a **new type of Configuration** is added for the case of non-administrator users "**EXTERNAL_CONFIGURATION**". 

This new type of configuration will allow users to simply load it into microservices. To do this, it is enough to create a **Configuration** object with the connection data against the environment where the desired configuration is located, then this object can be used to obtain the desired Configuration.


```java
ConfigurationManager manager = new ConfigurationManager("developer", "changeIt2020!", "https://hyperblast.onesaitplatform.com");
Configuration configuration = manager.getConfigurationById(configurationId);
```

For more details consult[ this tutorial.](https://onesaitplatform.atlassian.net/wiki/pages/createpage.action?spaceKey=doct&title=%C2%BFC%C3%B3mo%20usar%20utilidad%20Configuraci%C3%B3n%20Centralizada%20de%20Plataforma%20en%20tu%20aplicaci%C3%B3n%3F&linkCreation=true&fromPageId=2221606401)

Below is a complete example of how to operate with the Platform's Java Client:


```java
/**
 * Copyright Indra Soluciones Tecnologías de la Información, S.L.U.
 * 2013-2021 SPAIN
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.minsait.onesait.platform.client;

import java.io.IOException;
import java.util.List;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.minsait.onesait.platform.client.enums.ConfigurationType;
import com.minsait.onesait.platform.client.exception.ConfigurationManagerException;
import com.minsait.onesait.platform.client.model.Configuration;
import com.minsait.onesait.platform.testing.IntegrationTest;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Category(IntegrationTest.class)
public class TestConfigurationManager {

	private final static String USERNAME = "developer";
	private final static String PASSWORD = "Changed2019!";
	private final static String SERVER = "http://localhost:18000";
	private final static String IDENTIFICATION = "testing_01";
	private final static String ENVIRONMENT = "default";
	private final static String YML_SAMPLE = "rancher:\r\n  url: https://rancher.sofia4cities.com/\r\n  accessKey: 471D90A16431C2CE7158\r\n  secretKey: VSoq31eGBqaFsG4vUcuvdpkQL1T64FypVPVckaDx";
	private final static ConfigurationType TYPE = ConfigurationType.EXTERNAL_CONFIG;
	private static ConfigurationManager manager;

	@BeforeClass
	public static void startUp() throws ConfigurationManagerException {
		log.info("Initializing Manager");
		manager = new ConfigurationManager(USERNAME, PASSWORD, SERVER);
	}

	@Test
	public void getAllConfigurations() throws IOException, ConfigurationManagerException {
		log.info("Getting Configurations from open platform");
		final List<Configuration> configurations = manager.getConfigurations();
		Assert.assertTrue(configurations.size() > 0);
	}

	@Test
	public void configurationCRUD() throws IOException, ConfigurationManagerException {

		@SuppressWarnings("unchecked")
		final Configuration configuration = Configuration.builder().description("Rancher config sample")
				.environment(ENVIRONMENT).identification(IDENTIFICATION).username(USERNAME).type(TYPE).yml(YML_SAMPLE)
				.build();

		Configuration retrievedConfig = manager.getConfiguration(IDENTIFICATION, ConfigurationType.EXTERNAL_CONFIG,
				ENVIRONMENT);
		if (retrievedConfig != null) {
			log.info("Deleting configuration with id {}", retrievedConfig.getId());
			manager.deleteConfiguration(retrievedConfig.getId());
		}

		log.info("Creating configuration");
		final String id = manager.createConfiguration(configuration);
		Assert.assertNotNull(id);
		log.info("Created configuration, id is {}", id);
		retrievedConfig = manager.getConfigurationById(id);
		Assert.assertNotNull(retrievedConfig);
		log.info("Retrieved config from the platform by id");
		retrievedConfig = manager.getConfiguration(IDENTIFICATION, ConfigurationType.EXTERNAL_CONFIG, ENVIRONMENT);
		Assert.assertNotNull(retrievedConfig);
		log.info("Retrieved config from the platform by parameters");

		configuration.setDescription("This is a new description");
		log.info("Updating configuration with new description and identification {}", IDENTIFICATION);
		manager.updateConfiguration(configuration, id);

		log.info("Deleting configuration with id {}", id);
		manager.deleteConfiguration(IDENTIFICATION, ConfigurationType.EXTERNAL_CONFIG, ENVIRONMENT);

	}
}
```