Add sane defaults

This commit is contained in:
Maxime Dor
2017-09-07 00:07:49 +02:00
parent 158060a3b0
commit 45a81e5979
5 changed files with 51 additions and 22 deletions

2
.gitignore vendored
View File

@@ -7,4 +7,4 @@ out/
.idea/
# Local dev config
application.yaml
/application.yaml

View File

@@ -111,15 +111,6 @@ public class EmailSenderConfig {
@PostConstruct
private void postConstruct() {
if (StringUtils.isBlank(getContentPath())) {
throw new ConfigurationException("invite.sender.email.contentPath");
}
File cp = new File(getContentPath()).getAbsoluteFile();
if (!cp.exists() || !cp.isFile() || !cp.canRead()) {
throw new ConfigurationException("invite.sender.email.contentPath", getContentPath() + " does not exist, is not a file or cannot be read");
}
log.info("--- E-mail Invite Sender config ---");
log.info("Host: {}", getHost());
log.info("Port: {}", getPort());
@@ -127,7 +118,16 @@ public class EmailSenderConfig {
log.info("Login: {}", getLogin());
log.info("Has password: {}", StringUtils.isBlank(getPassword()));
log.info("E-mail: {}", getEmail());
if (StringUtils.isBlank(getContentPath())) {
log.warn("invite.sender.contentPath is empty! Will not send invites");
} else {
File cp = new File(getContentPath()).getAbsoluteFile();
if (!cp.exists() || !cp.isFile() || !cp.canRead()) {
throw new ConfigurationException("invite.sender.email.contentPath", getContentPath() + " does not exist, is not a file or cannot be read");
} else {
log.info("Content path: {}", cp.getAbsolutePath());
}
}
}
}

View File

@@ -20,13 +20,9 @@
package io.kamax.mxisd.config.ldap;
import io.kamax.mxisd.lookup.provider.LdapProvider;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
@ConfigurationProperties(prefix = "ldap.attribute.uid")
public class LdapAttributeUidConfig {
@@ -50,11 +46,4 @@ public class LdapAttributeUidConfig {
this.value = value;
}
@PostConstruct
public void postConstruct() {
if (!StringUtils.equals(LdapProvider.UID, getType()) && !StringUtils.equals(LdapProvider.MATRIX_ID, getType())) {
throw new IllegalArgumentException("Unsupported LDAP UID type: " + getType());
}
}
}

View File

@@ -21,6 +21,7 @@
package io.kamax.mxisd.config.ldap
import groovy.json.JsonOutput
import io.kamax.mxisd.lookup.provider.LdapProvider
import org.apache.commons.lang.StringUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -110,6 +111,10 @@ class LdapConfig {
throw new IllegalStateException("Attribute UID value cannot be empty")
}
String uidType = attribute.getUid().getType();
if (!StringUtils.equals(LdapProvider.UID, uidType) && !StringUtils.equals(LdapProvider.MATRIX_ID, uidType)) {
throw new IllegalArgumentException("Unsupported LDAP UID type: " + uidType)
}
log.info("Conn: {}", JsonOutput.toJson(conn))
log.info("Host: {}", conn.getHost())

View File

@@ -0,0 +1,35 @@
# -- Default values for important properties --
server:
port: 8090
lookup:
recursive:
enabled: true
allowedCidr:
- '127.0.0.0/8'
- '10.0.0.0/8'
- '172.16.0.0/12'
- '192.168.0.0/16'
- '::1/128'
bridge:
enabled: false
recursiveOnly: true
ldap:
enabled: false
forward:
servers:
- "https://matrix.org"
- "https://vector.im"
firebase:
enabled: false
invite:
sender:
email:
tls: 1
name: "mxisd Identity Server"