Config handling

This commit is contained in:
Maxime Dor
2017-04-26 14:48:40 +02:00
parent c26f8e5298
commit 86b9d4b0a8
3 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
package io.kamax.mxisd.config
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.InitializingBean
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Configuration
@Configuration
@ConfigurationProperties(prefix = "lookup.recursive.bridge")
class RecursiveLookupBridgeConfig implements InitializingBean {
private Logger log = LoggerFactory.getLogger(RecursiveLookupBridgeConfig.class)
private boolean enabled
private boolean recursiveOnly
private String server
private Map<String, String> mappings
boolean getEnabled() {
return enabled
}
void setEnabled(boolean enabled) {
this.enabled = enabled
}
boolean getRecursiveOnly() {
return recursiveOnly
}
void setRecursiveOnly(boolean recursiveOnly) {
this.recursiveOnly = recursiveOnly
}
String getServer() {
return server
}
void setServer(String server) {
this.server = server
}
Map<String, String> getMappings() {
return mappings
}
void setMappings(Map<String, String> mappings) {
this.mappings = mappings
}
@Override
void afterPropertiesSet() throws Exception {
log.info("Enabled: {}", getEnabled())
log.info("Recursive only: {}", getRecursiveOnly())
log.info("Server: {}", getServer())
log.info("Mappings: {}", mappings.size())
}
}

View File

@@ -29,6 +29,7 @@ class RecursiveLookupConfig {
private boolean enabled
private List<String> allowedCidr
private RecursiveLookupBridgeConfig bridge
boolean isEnabled() {
return enabled
@@ -46,4 +47,12 @@ class RecursiveLookupConfig {
this.allowedCidr = allowedCidr
}
RecursiveLookupBridgeConfig getBridge() {
return bridge
}
void setBridge(RecursiveLookupBridgeConfig bridge) {
this.bridge = bridge
}
}