Configuration management
- Default values - Compute values
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
package io.kamax.mxisd.config.rest;
|
package io.kamax.mxisd.config.rest;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import io.kamax.mxisd.exception.ConfigurationException;
|
import io.kamax.mxisd.exception.ConfigurationException;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -112,14 +111,9 @@ public class RestBackendConfig {
|
|||||||
this.endpoints = endpoints;
|
this.endpoints = endpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
private String buildEndpointUrl(String endpoint) {
|
||||||
private void postConstruct() {
|
if (StringUtils.startsWith(endpoint, "/")) {
|
||||||
Gson gson = new Gson();
|
if (StringUtils.isBlank(getHost())) {
|
||||||
log.info("--- REST backend config ---");
|
|
||||||
log.info("Enabled: {}", isEnabled());
|
|
||||||
|
|
||||||
if (isEnabled()) {
|
|
||||||
if (StringUtils.isBlank(host)) {
|
|
||||||
throw new ConfigurationException("rest.host");
|
throw new ConfigurationException("rest.host");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,8 +123,26 @@ public class RestBackendConfig {
|
|||||||
throw new ConfigurationException("rest.host", e.getMessage());
|
throw new ConfigurationException("rest.host", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return getHost() + endpoint;
|
||||||
|
} else {
|
||||||
|
return endpoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
private void postConstruct() {
|
||||||
|
log.info("--- REST backend config ---");
|
||||||
|
log.info("Enabled: {}", isEnabled());
|
||||||
|
|
||||||
|
if (isEnabled()) {
|
||||||
|
endpoints.setAuth(buildEndpointUrl(endpoints.getAuth()));
|
||||||
|
endpoints.identity.setSingle(buildEndpointUrl(endpoints.identity.getSingle()));
|
||||||
|
endpoints.identity.setBulk(buildEndpointUrl(endpoints.identity.getBulk()));
|
||||||
|
|
||||||
log.info("Host: {}", getHost());
|
log.info("Host: {}", getHost());
|
||||||
log.info("Endpoints: {}", gson.toJson(endpoints));
|
log.info("Auth endpoint: {}", endpoints.getAuth());
|
||||||
|
log.info("Identity Single endpoint: {}", endpoints.identity.getSingle());
|
||||||
|
log.info("Identity Bulk endpoint: {}", endpoints.identity.getBulk());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,6 +23,13 @@ lookup:
|
|||||||
enabled: false
|
enabled: false
|
||||||
recursiveOnly: true
|
recursiveOnly: true
|
||||||
|
|
||||||
|
rest:
|
||||||
|
endpoints:
|
||||||
|
auth: "/_mxisd/identity/api/v1/auth"
|
||||||
|
identity:
|
||||||
|
single: "/_mxisd/identity/api/v1/lookup/single"
|
||||||
|
bulk: "/_mxisd/identity/api/v1/lookup/bulk"
|
||||||
|
|
||||||
ldap:
|
ldap:
|
||||||
enabled: false
|
enabled: false
|
||||||
connection:
|
connection:
|
||||||
|
Reference in New Issue
Block a user