diff --git a/.gitignore b/.gitignore index 59aba00..5a642a0 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ out/ .idea/ # Local dev config -application.yaml +/application.yaml diff --git a/src/main/groovy/io/kamax/mxisd/config/invite/sender/EmailSenderConfig.java b/src/main/groovy/io/kamax/mxisd/config/invite/sender/EmailSenderConfig.java index 4a4d962..886f062 100644 --- a/src/main/groovy/io/kamax/mxisd/config/invite/sender/EmailSenderConfig.java +++ b/src/main/groovy/io/kamax/mxisd/config/invite/sender/EmailSenderConfig.java @@ -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()); - log.info("Content path: {}", cp.getAbsolutePath()); + 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()); + } + } } } diff --git a/src/main/groovy/io/kamax/mxisd/config/ldap/LdapAttributeUidConfig.java b/src/main/groovy/io/kamax/mxisd/config/ldap/LdapAttributeUidConfig.java index 67630de..57547b8 100644 --- a/src/main/groovy/io/kamax/mxisd/config/ldap/LdapAttributeUidConfig.java +++ b/src/main/groovy/io/kamax/mxisd/config/ldap/LdapAttributeUidConfig.java @@ -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()); - } - } - } diff --git a/src/main/groovy/io/kamax/mxisd/config/ldap/LdapConfig.groovy b/src/main/groovy/io/kamax/mxisd/config/ldap/LdapConfig.groovy index 55fd3d7..946c287 100644 --- a/src/main/groovy/io/kamax/mxisd/config/ldap/LdapConfig.groovy +++ b/src/main/groovy/io/kamax/mxisd/config/ldap/LdapConfig.groovy @@ -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()) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml new file mode 100644 index 0000000..a394e42 --- /dev/null +++ b/src/main/resources/application.yaml @@ -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"