consul-kv-bootstrapper
A utility application acting as a configuration bootstrapper for client applications with spring beans.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.1%) to scientific vocabulary
Repository
A utility application acting as a configuration bootstrapper for client applications with spring beans.
Basic Info
Statistics
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Consul KV Configuration Bootstrapper
Applications use different variables (e.g. connector hosts, ports, application-specific environment values) for the tasks they accomplish. Most applications require these parameters at startup, where the application is initialized with the configurations as global constants which are used at runtime. Consul KV is such a Key-Value store for storing said configurations.
This application is a utility application to bootstrap application configurations held
in Consul KV upon client application initialization. Upon initialization of a Spring Bean (@Bean, @Component, etc.) use @ConsulKVBootstrapper to return properties declared in a consul-config.yml file.
```java @Configuration public static class TestConfig {
@Autowired
static Properties properties;
@ConsulKVBootstrapper(configFilePath = "{FILE_PATH}")
@Bean
Properties properties( Properties properties )
{
TestConfig.properties = properties;
return properties;
}
public static Properties getProperties() {
return properties;
}
} ```
If it is required to set up the consul-config.yml file in JVM environment variables, make sure you indicate the configFilePath parameter as follows:
java
@ConsulKVBootstrapper(configFilePath = "{FILE_PATH}")
FILE_PATH you need to add to the JVM environments.
What does the annotation ConsulKVBootstrapper do?
The annotation sends Consul agent a request and fetches key-values according to the
criteria that the user provides in the configuration file. Afterwards, it serializes those
configurations into a Properties objects and injects into the method which is annotated with
@ConsulKVBootstrapper. Note that the method annotated must take in Properties object as an argument.
Configuration file
```yaml consulHost: localhost consulPort: 8500 serviceId: 1 serviceName: example configurations: - TESTKEY1
```
If it is required to fetch all configurations, remove configurations node from the yml.
Note: Please add io.realitix.* and com.github.* in @ComponentScan as @ComponentScan(basePackages = {"io.realitix.*", "com.github.*", "<your base packages>.*"}) in your main SpringBootApplication so that the dependency components will get scanned.
Maven Dependency
xml
<dependency>
<groupId>com.github.dasunpubudumal</groupId>
<artifactId>consul-kv-bootstrapper</artifactId>
<version>1.0.0</version>
</dependency>
Add following to <repositories>.
xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Owner
- Name: Dasun Pubudumal
- Login: dasunpubudumal
- Kind: user
- Location: Colombo, Sri Lanka.
- Company: @RotaractMora @UOMCSE @TeamLoggers
- Website: https://dasunpubudumal.medium.com/
- Repositories: 7
- Profile: https://github.com/dasunpubudumal
Learning by making mistakes have been always been my passion. Interested in server-side programming.
Citation (CITATION.cff)
message: "If you use this software, please cite it as below."
authors:
- family-names: Pubudumal
given-names: Dasun
title: "Consul KV Bootstrapper"
version: 1.0.0
date-released: 2021-08-11
GitHub Events
Total
Last Year
Dependencies
- org.springframework.boot:spring-boot-dependencies 2.5.3 import
- com.fasterxml.jackson.core:jackson-databind
- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
- com.google.guava:guava 22.0
- com.orbitz.consul:consul-client 1.5.3
- org.apache.commons:commons-lang3
- org.springframework.boot:spring-boot-starter-aop
- org.springframework.boot:spring-boot-starter-web
- org.junit.jupiter:junit-jupiter-engine test
- org.springframework.boot:spring-boot-starter-test test