Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/main/java/com/axway/ExternalConfigLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ private void updatePassword(EntityStore entityStore) {
Set<String> keys = envValues.keySet();
Iterator<String> keysIterator = keys.iterator();

Map<String, String> ldap = groupEnvVariables(envValues,"ldap_");
Map<String, String> jms = groupEnvVariables(envValues,"jms_");
Map<String, String> smtp = groupEnvVariables(envValues,"smtp_");
Map<String, String> ldap = groupEnvVariables(envValues, "ldap_");
Map<String, String> jms = groupEnvVariables(envValues, "jms_");
Map<String, String> smtp = groupEnvVariables(envValues, "smtp_");
Map<String, String> cassandraConsistency = groupEnvVariables(envValues, "cassandraconsistency_");

while (keysIterator.hasNext()) {
Expand Down Expand Up @@ -198,7 +198,7 @@ private void updatePassword(EntityStore entityStore) {
}
}

private Map<String, String> groupEnvVariables( Map<String, String> envValues, String namePrefix){
private Map<String, String> groupEnvVariables(Map<String, String> envValues, String namePrefix) {
return envValues.entrySet()
.stream()
.filter(map -> map.getKey().startsWith(namePrefix))
Expand Down Expand Up @@ -314,7 +314,7 @@ private void updateSMTP(EntityStore entityStore, Credential credential) {
if (host != null) {
entity.setStringField("smtpServer", host);
}
updateMailConnectionType(entity, credential.getFilterName());
updateMailConnectionTypeAndPort(entity, credential.getFilterName());
entityStore.updateEntity(entity);
}

Expand All @@ -329,11 +329,12 @@ private void updateAlertSMTP(EntityStore entityStore, Credential credential) {
if (host != null) {
entity.setStringField("smtp", host);
}
updateMailConnectionType(entity, credential.getFilterName());
updateMailConnectionTypeAndPort(entity, credential.getFilterName());
entityStore.updateEntity(entity);
}
}
private void updateMailConnectionType(Entity entity, String filterName) {

private void updateMailConnectionTypeAndPort(Entity entity, String filterName) {
String connectionType = System.getenv("smtp_" + filterName + "_connectionType");
if (connectionType != null) {
// Possible Values NONE, SSL TLS
Expand All @@ -343,6 +344,15 @@ private void updateMailConnectionType(Entity entity, String filterName) {
Trace.error("Invalid connection type : " + connectionType);
}
}

String port = System.getenv("smtp_" + filterName + "_port");
if (port != null) {
try {
entity.setIntegerField("port", Integer.parseInt(port));
}catch (NumberFormatException e){
Trace.error("Invalid SMTP port number :"+port);
}
}
}

private void updateCassandraCert(EntityStore entityStore, String alias, boolean append) {
Expand Down Expand Up @@ -600,7 +610,7 @@ private void updateCassandraConsistencyLevel(EntityStore entityStore, String rea
private void updateCassandraConsistencyLevel(ShorthandKeyFinder shorthandKeyFinder, String shorthandKey, String readConsistencyLevelFieldName, String readConsistencyLevel, String writeConsistencyLevelFieldName, String writeConsistencyLevel) {
List<Entity> kpsEntities = shorthandKeyFinder.getEntities(shorthandKey);
if (kpsEntities != null) {
Trace.info("Total number of KPS Store: " + kpsEntities.size() + " in entity : "+ shorthandKey);
Trace.info("Total number of KPS Store: " + kpsEntities.size() + " in entity : " + shorthandKey);
EntityStore entityStore = shorthandKeyFinder.getEntityStore();
for (Entity entity : kpsEntities) {
// Trace.info(entity.toString());
Expand Down