https://github.com/entando/config-connector
Entando Config Service connector
https://github.com/entando/config-connector
Last synced: 9 months ago
JSON representation
Entando Config Service connector
- Host: GitHub
- URL: https://github.com/entando/config-connector
- Owner: entando
- License: gpl-3.0
- Created: 2019-04-30T18:29:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T20:57:08.000Z (about 4 years ago)
- Last Synced: 2025-03-26T21:34:05.404Z (over 1 year ago)
- Language: Java
- Size: 33.2 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Entando Config Service Connector
[](https://jenkins.entandocloud.com/job/de-config-connector-master/)
[](https://coveralls.io/github/entando/config-connector?branch=master)
This library is used to integrate with Entando ConfigService without the need to implement the communication to the service.
## Install
Add the dependency to your project
```xml
org.entando
config-connector
1.0.0-SNAPSHOT
```
Then create a Configuration class to create the bean
```java
@Configuration
public class ConfigServiceConfiguration {
@Bean
public ConfigService configService(
@Value("${client-id}") final String clientId,
@Value("${client-secret}") final String clientSecret,
@Value("${access-token-uri}") final String accessTokenUri,
@Value("${config-service-uri}") final String configServiceUri) {
return new ConfigService<>(clientId, clientSecret, accessTokenUri, configServiceUri, YourCustomConfig.class);
}
}
```
Now you can use the service, for example a wrapper:
```java
@Service
public class YourCustomConfigService {
private final ConfigService configService;
@Autowired
public YourCustomConfigService(final ConfigService configService) {
this.configService = configService;
}
public YourCustomConfig getConfig() {
return Optional.ofNullable(configService.getConfig())
.orElseGet(YourCustomConfig::getDefault);
}
public void updateAvatarConfig(final YourCustomConfig config) {
configService.updateConfig(config);
}
}
```
The configuration is builtin with a memory cache (Guava).
At the moment it is not configurable and has 10 minutes TTL.