Start structural port from Spring Boot to Undertow
This commit is contained in:
@@ -20,16 +20,10 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "auth")
|
||||
public class AuthenticationConfig {
|
||||
|
||||
public static class Rule {
|
||||
@@ -102,7 +96,6 @@ public class AuthenticationConfig {
|
||||
this.rewrite = rewrite;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
getRewrite().getUser().getRules().forEach(mapping -> mapping.setPattern(Pattern.compile(mapping.getRegex())));
|
||||
}
|
||||
|
||||
@@ -20,14 +20,9 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Objects;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "lookup.bulk")
|
||||
public class BulkLookupConfig {
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
@@ -22,16 +22,12 @@ package io.kamax.mxisd.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("directory")
|
||||
public class DirectoryConfig {
|
||||
|
||||
private final transient Logger log = LoggerFactory.getLogger(DnsOverwriteConfig.class);
|
||||
private final static Logger log = LoggerFactory.getLogger(DirectoryConfig.class);
|
||||
|
||||
public static class Exclude {
|
||||
|
||||
@@ -68,7 +64,7 @@ public class DirectoryConfig {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void buid() {
|
||||
public void build() {
|
||||
log.info("--- Directory config ---");
|
||||
log.info("Exclude:");
|
||||
log.info("\tHomeserver: {}", getExclude().getHomeserver());
|
||||
|
||||
@@ -24,18 +24,14 @@ import com.google.gson.Gson;
|
||||
import io.kamax.mxisd.util.GsonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("dns.overwrite")
|
||||
public class DnsOverwriteConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(DnsOverwriteConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(DnsOverwriteConfig.class);
|
||||
|
||||
public static class Entry {
|
||||
|
||||
|
||||
@@ -21,14 +21,10 @@
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("exec")
|
||||
public class ExecConfig {
|
||||
|
||||
public class IO {
|
||||
@@ -517,7 +513,7 @@ public class ExecConfig {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public ExecConfig compute() {
|
||||
public ExecConfig build() {
|
||||
if (Objects.isNull(getAuth().isEnabled())) {
|
||||
getAuth().setEnabled(isEnabled());
|
||||
}
|
||||
|
||||
@@ -20,27 +20,14 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import io.kamax.mxisd.auth.provider.AuthenticatorProvider;
|
||||
import io.kamax.mxisd.backend.firebase.GoogleFirebaseAuthenticator;
|
||||
import io.kamax.mxisd.backend.firebase.GoogleFirebaseProvider;
|
||||
import io.kamax.mxisd.lookup.provider.IThreePidProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("firebase")
|
||||
public class FirebaseConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(FirebaseConfig.class);
|
||||
|
||||
@Autowired
|
||||
private MatrixConfig mxCfg;
|
||||
private transient final Logger log = LoggerFactory.getLogger(FirebaseConfig.class);
|
||||
|
||||
private boolean enabled;
|
||||
private String credentials;
|
||||
@@ -80,14 +67,4 @@ public class FirebaseConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticatorProvider getAuthProvider() {
|
||||
return new GoogleFirebaseAuthenticator(enabled, credentials, database);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IThreePidProvider getLookupProvider() {
|
||||
return new GoogleFirebaseProvider(enabled, credentials, database, mxCfg.getDomain());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,14 +20,9 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "forward")
|
||||
public class ForwardConfig {
|
||||
|
||||
private List<String> servers = new ArrayList<>();
|
||||
@@ -40,4 +35,8 @@ public class ForwardConfig {
|
||||
this.servers = servers;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,16 +23,12 @@ package io.kamax.mxisd.config;
|
||||
import io.kamax.mxisd.util.GsonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("invite")
|
||||
public class InvitationConfig {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(InvitationConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(InvitationConfig.class);
|
||||
|
||||
public static class Resolution {
|
||||
|
||||
|
||||
@@ -22,13 +22,9 @@ package io.kamax.mxisd.config;
|
||||
|
||||
import io.kamax.mxisd.exception.ConfigurationException;
|
||||
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 = "key")
|
||||
public class KeyConfig {
|
||||
|
||||
private String path;
|
||||
|
||||
@@ -21,15 +21,11 @@
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("matrix.listener")
|
||||
public class ListenerConfig {
|
||||
|
||||
public static class Token {
|
||||
|
||||
@@ -25,16 +25,12 @@ import io.kamax.mxisd.exception.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("matrix")
|
||||
public class MatrixConfig {
|
||||
|
||||
public static class Identity {
|
||||
@@ -57,10 +53,11 @@ public class MatrixConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(MatrixConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(MatrixConfig.class);
|
||||
|
||||
private String domain;
|
||||
private Identity identity = new Identity();
|
||||
private ListenerConfig listener = new ListenerConfig();
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
@@ -78,6 +75,14 @@ public class MatrixConfig {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public ListenerConfig getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void setListener(ListenerConfig listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
log.info("--- Matrix config ---");
|
||||
|
||||
329
src/main/java/io/kamax/mxisd/config/MxisdConfig.java
Normal file
329
src/main/java/io/kamax/mxisd/config/MxisdConfig.java
Normal file
@@ -0,0 +1,329 @@
|
||||
/*
|
||||
* mxisd - Matrix Identity Server Daemon
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.kamax.mxisd.config.ldap.generic.GenericLdapConfig;
|
||||
import io.kamax.mxisd.config.ldap.netiq.NetIqLdapConfig;
|
||||
import io.kamax.mxisd.config.memory.MemoryStoreConfig;
|
||||
import io.kamax.mxisd.config.rest.RestBackendConfig;
|
||||
import io.kamax.mxisd.config.sql.generic.GenericSqlProviderConfig;
|
||||
import io.kamax.mxisd.config.sql.synapse.SynapseSqlProviderConfig;
|
||||
import io.kamax.mxisd.config.threepid.notification.NotificationConfig;
|
||||
import io.kamax.mxisd.config.wordpress.WordpressConfig;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MxisdConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MxisdConfig.class);
|
||||
|
||||
public static class Dns {
|
||||
|
||||
private DnsOverwriteConfig overwrite = new DnsOverwriteConfig();
|
||||
|
||||
public DnsOverwriteConfig getOverwrite() {
|
||||
return overwrite;
|
||||
}
|
||||
|
||||
public void setOverwrite(DnsOverwriteConfig overwrite) {
|
||||
this.overwrite = overwrite;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Lookup {
|
||||
|
||||
private BulkLookupConfig bulk = new BulkLookupConfig();
|
||||
private RecursiveLookupConfig recursive = new RecursiveLookupConfig();
|
||||
|
||||
public BulkLookupConfig getBulk() {
|
||||
return bulk;
|
||||
}
|
||||
|
||||
public void setBulk(BulkLookupConfig bulk) {
|
||||
this.bulk = bulk;
|
||||
}
|
||||
|
||||
public RecursiveLookupConfig getRecursive() {
|
||||
return recursive;
|
||||
}
|
||||
|
||||
public void setRecursive(RecursiveLookupConfig recursive) {
|
||||
this.recursive = recursive;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
getBulk().build();
|
||||
getRecursive().build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Threepid {
|
||||
|
||||
private Map<String, JsonObject> medium = new HashMap<>();
|
||||
|
||||
public Map<String, JsonObject> getMedium() {
|
||||
return medium;
|
||||
}
|
||||
|
||||
public void setMedium(Map<String, JsonObject> medium) {
|
||||
this.medium = medium;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private AuthenticationConfig auth = new AuthenticationConfig();
|
||||
private DirectoryConfig directory = new DirectoryConfig();
|
||||
private Dns dns = new Dns();
|
||||
private ExecConfig exec = new ExecConfig();
|
||||
private FirebaseConfig firebase = new FirebaseConfig();
|
||||
private ForwardConfig forward = new ForwardConfig();
|
||||
private InvitationConfig invite = new InvitationConfig();
|
||||
private KeyConfig key = new KeyConfig();
|
||||
private GenericLdapConfig ldap = new GenericLdapConfig();
|
||||
private Lookup lookup = new Lookup();
|
||||
private MatrixConfig matrix = new MatrixConfig();
|
||||
private MemoryStoreConfig memory = new MemoryStoreConfig();
|
||||
private NotificationConfig notification = new NotificationConfig();
|
||||
private NetIqLdapConfig netiq = new NetIqLdapConfig();
|
||||
private ServerConfig server = new ServerConfig();
|
||||
private SessionConfig session = new SessionConfig();
|
||||
private StorageConfig storage = new StorageConfig();
|
||||
private RestBackendConfig rest = new RestBackendConfig();
|
||||
private GenericSqlProviderConfig sql = new GenericSqlProviderConfig();
|
||||
private SynapseSqlProviderConfig synapseSql = new SynapseSqlProviderConfig();
|
||||
private ViewConfig view = new ViewConfig();
|
||||
private WordpressConfig wordpress = new WordpressConfig();
|
||||
|
||||
public AuthenticationConfig getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(AuthenticationConfig auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public DirectoryConfig getDirectory() {
|
||||
return directory;
|
||||
}
|
||||
|
||||
public void setDirectory(DirectoryConfig directory) {
|
||||
this.directory = directory;
|
||||
}
|
||||
|
||||
public Dns getDns() {
|
||||
return dns;
|
||||
}
|
||||
|
||||
public void setDns(Dns dns) {
|
||||
this.dns = dns;
|
||||
}
|
||||
|
||||
public ExecConfig getExec() {
|
||||
return exec;
|
||||
}
|
||||
|
||||
public void setExec(ExecConfig exec) {
|
||||
this.exec = exec;
|
||||
}
|
||||
|
||||
public FirebaseConfig getFirebase() {
|
||||
return firebase;
|
||||
}
|
||||
|
||||
public void setFirebase(FirebaseConfig firebase) {
|
||||
this.firebase = firebase;
|
||||
}
|
||||
|
||||
public ForwardConfig getForward() {
|
||||
return forward;
|
||||
}
|
||||
|
||||
public void setForward(ForwardConfig forward) {
|
||||
this.forward = forward;
|
||||
}
|
||||
|
||||
public InvitationConfig getInvite() {
|
||||
return invite;
|
||||
}
|
||||
|
||||
public void setInvite(InvitationConfig invite) {
|
||||
this.invite = invite;
|
||||
}
|
||||
|
||||
public KeyConfig getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(KeyConfig key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public GenericLdapConfig getLdap() {
|
||||
return ldap;
|
||||
}
|
||||
|
||||
public void setLdap(GenericLdapConfig ldap) {
|
||||
this.ldap = ldap;
|
||||
}
|
||||
|
||||
public Lookup getLookup() {
|
||||
return lookup;
|
||||
}
|
||||
|
||||
public void setLookup(Lookup lookup) {
|
||||
this.lookup = lookup;
|
||||
}
|
||||
|
||||
public MatrixConfig getMatrix() {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
public void setMatrix(MatrixConfig matrix) {
|
||||
this.matrix = matrix;
|
||||
}
|
||||
|
||||
public MemoryStoreConfig getMemory() {
|
||||
return memory;
|
||||
}
|
||||
|
||||
public void setMemory(MemoryStoreConfig memory) {
|
||||
this.memory = memory;
|
||||
}
|
||||
|
||||
public NotificationConfig getNotification() {
|
||||
return notification;
|
||||
}
|
||||
|
||||
public void setNotification(NotificationConfig notification) {
|
||||
this.notification = notification;
|
||||
}
|
||||
|
||||
public NetIqLdapConfig getNetiq() {
|
||||
return netiq;
|
||||
}
|
||||
|
||||
public void setNetiq(NetIqLdapConfig netiq) {
|
||||
this.netiq = netiq;
|
||||
}
|
||||
|
||||
public ServerConfig getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public void setServer(ServerConfig server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public SessionConfig getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void setSession(SessionConfig session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public StorageConfig getStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void setStorage(StorageConfig storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public RestBackendConfig getRest() {
|
||||
return rest;
|
||||
}
|
||||
|
||||
public void setRest(RestBackendConfig rest) {
|
||||
this.rest = rest;
|
||||
}
|
||||
|
||||
public GenericSqlProviderConfig getSql() {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public void setSql(GenericSqlProviderConfig sql) {
|
||||
this.sql = sql;
|
||||
}
|
||||
|
||||
public SynapseSqlProviderConfig getSynapseSql() {
|
||||
return synapseSql;
|
||||
}
|
||||
|
||||
public void setSynapseSql(SynapseSqlProviderConfig synapseSql) {
|
||||
this.synapseSql = synapseSql;
|
||||
}
|
||||
|
||||
public ViewConfig getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setView(ViewConfig view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
public WordpressConfig getWordpress() {
|
||||
return wordpress;
|
||||
}
|
||||
|
||||
public void setWordpress(WordpressConfig wordpress) {
|
||||
this.wordpress = wordpress;
|
||||
}
|
||||
|
||||
public MxisdConfig build() {
|
||||
if (StringUtils.isBlank(getServer().getName())) {
|
||||
getServer().setName(getMatrix().getDomain());
|
||||
log.debug("server.name is empty, using matrix.domain");
|
||||
}
|
||||
|
||||
getAuth().build();
|
||||
getDirectory().build();
|
||||
getExec().build();
|
||||
getFirebase().build();
|
||||
getForward().build();
|
||||
getInvite().build();
|
||||
getKey().build();
|
||||
getLdap().build();
|
||||
getLookup().build();
|
||||
getMatrix().build();
|
||||
getMemory().build();
|
||||
getNetiq().build();
|
||||
getNotification().build();
|
||||
getRest().build();
|
||||
getSession().build();
|
||||
getServer().build();
|
||||
getSql().build();
|
||||
getStorage().build();
|
||||
getSynapseSql().build();
|
||||
getView().build();
|
||||
getWordpress().build();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,18 +22,14 @@ package io.kamax.mxisd.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "lookup.recursive.bridge")
|
||||
public class RecursiveLookupBridgeConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(RecursiveLookupBridgeConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(RecursiveLookupBridgeConfig.class);
|
||||
|
||||
private boolean enabled;
|
||||
private boolean recursiveOnly;
|
||||
|
||||
@@ -20,18 +20,14 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "lookup.recursive")
|
||||
public class RecursiveLookupConfig {
|
||||
|
||||
private boolean enabled;
|
||||
private List<String> allowedCidr;
|
||||
private RecursiveLookupBridgeConfig bridge;
|
||||
private List<String> allowedCidr = new ArrayList<>();
|
||||
private RecursiveLookupBridgeConfig bridge = new RecursiveLookupBridgeConfig();
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
@@ -57,4 +53,8 @@ public class RecursiveLookupConfig {
|
||||
this.bridge = bridge;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("storage.provider.sqlite")
|
||||
public class SQLiteStorageConfig {
|
||||
|
||||
private String database;
|
||||
|
||||
@@ -23,25 +23,17 @@ package io.kamax.mxisd.config;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "server")
|
||||
public class ServerConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(ServerConfig.class);
|
||||
|
||||
@Autowired
|
||||
private MatrixConfig mxCfg;
|
||||
private transient final Logger log = LoggerFactory.getLogger(ServerConfig.class);
|
||||
|
||||
private String name;
|
||||
private int port;
|
||||
private int port = 8090;
|
||||
private String publicUrl;
|
||||
|
||||
public String getName() {
|
||||
@@ -72,11 +64,6 @@ public class ServerConfig {
|
||||
public void build() {
|
||||
log.info("--- Server config ---");
|
||||
|
||||
if (StringUtils.isBlank(getName())) {
|
||||
setName(mxCfg.getDomain());
|
||||
log.debug("server.name is empty, using matrix.domain");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(getPublicUrl())) {
|
||||
setPublicUrl("https://" + getName());
|
||||
log.debug("Public URL is empty, generating from name");
|
||||
|
||||
@@ -23,17 +23,12 @@ package io.kamax.mxisd.config;
|
||||
import com.google.gson.Gson;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("session")
|
||||
public class SessionConfig {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(SessionConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(SessionConfig.class);
|
||||
|
||||
public static class Policy {
|
||||
|
||||
@@ -144,18 +139,8 @@ public class SessionConfig {
|
||||
|
||||
}
|
||||
|
||||
private MatrixConfig mxCfg;
|
||||
private Policy policy = new Policy();
|
||||
|
||||
@Autowired
|
||||
public SessionConfig(MatrixConfig mxCfg) {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
public MatrixConfig getMatrixCfg() {
|
||||
return mxCfg;
|
||||
}
|
||||
|
||||
public Policy getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
@@ -22,16 +22,27 @@ package io.kamax.mxisd.config;
|
||||
|
||||
import io.kamax.mxisd.exception.ConfigurationException;
|
||||
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("storage")
|
||||
public class StorageConfig {
|
||||
|
||||
private String backend;
|
||||
public static class Provider {
|
||||
|
||||
private SQLiteStorageConfig sqlite = new SQLiteStorageConfig();
|
||||
|
||||
public SQLiteStorageConfig getSqlite() {
|
||||
return sqlite;
|
||||
}
|
||||
|
||||
public void setSqlite(SQLiteStorageConfig sqlite) {
|
||||
this.sqlite = sqlite;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String backend = "sqlite";
|
||||
private Provider provider = new Provider();
|
||||
|
||||
public String getBackend() {
|
||||
return backend;
|
||||
@@ -41,8 +52,16 @@ public class StorageConfig {
|
||||
this.backend = backend;
|
||||
}
|
||||
|
||||
public Provider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(Provider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
public void build() {
|
||||
if (StringUtils.isBlank(getBackend())) {
|
||||
throw new ConfigurationException("storage.backend");
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* mxisd - Matrix Identity Server Daemon
|
||||
* Copyright (C) 2017 Kamax Sarl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.thymeleaf.resourceresolver.FileResourceResolver;
|
||||
import org.thymeleaf.templateresolver.TemplateResolver;
|
||||
|
||||
@Configuration
|
||||
public class ThymeleafConfig {
|
||||
|
||||
@Bean
|
||||
public TemplateResolver getFileSystemResolver() {
|
||||
TemplateResolver resolver = new TemplateResolver();
|
||||
resolver.setPrefix("");
|
||||
resolver.setSuffix("");
|
||||
resolver.setCacheable(false);
|
||||
resolver.setOrder(1);
|
||||
resolver.setResourceResolver(new FileResourceResolver());
|
||||
return resolver;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,19 +20,15 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.kamax.matrix.json.GsonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("view")
|
||||
public class ViewConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(ViewConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(ViewConfig.class);
|
||||
|
||||
public static class Session {
|
||||
|
||||
@@ -138,7 +134,7 @@ public class ViewConfig {
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
log.info("--- View config ---");
|
||||
log.info("Session: {}", new Gson().toJson(session));
|
||||
log.info("Session: {}", GsonUtil.get().toJson(session));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* mxisd - Matrix Identity Server Daemon
|
||||
* Copyright (C) 2018 Kamax Sarl
|
||||
* Copyright (C) 2018 Kamax Sàrl
|
||||
*
|
||||
* https://www.kamax.io/
|
||||
*
|
||||
@@ -20,17 +20,23 @@
|
||||
|
||||
package io.kamax.mxisd.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import io.kamax.matrix.json.GsonUtil;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.constructor.Constructor;
|
||||
import org.yaml.snakeyaml.representer.Representer;
|
||||
|
||||
@Configuration
|
||||
public class AsyncConfig extends WebMvcConfigurerAdapter {
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
@Override
|
||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
||||
configurer.setDefaultTimeout(60 * 60 * 1000); // 1h in milliseconds
|
||||
super.configureAsyncSupport(configurer);
|
||||
public class YamlConfigLoader {
|
||||
|
||||
public static MxisdConfig loadFromFile(String path) throws IOException {
|
||||
Representer rep = new Representer();
|
||||
rep.getPropertyUtils().setAllowReadOnlyProperties(true);
|
||||
rep.getPropertyUtils().setSkipMissingProperties(true);
|
||||
Yaml yaml = new Yaml(new Constructor(MxisdConfig.class), rep);
|
||||
Object o = yaml.load(new FileInputStream(path));
|
||||
return GsonUtil.get().fromJson(GsonUtil.get().toJson(o), MxisdConfig.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public abstract class LdapConfig {
|
||||
|
||||
}
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(LdapConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(LdapConfig.class);
|
||||
|
||||
private boolean enabled;
|
||||
private String filter;
|
||||
|
||||
@@ -21,13 +21,7 @@
|
||||
package io.kamax.mxisd.config.ldap.generic;
|
||||
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "ldap")
|
||||
@Primary
|
||||
public class GenericLdapConfig extends LdapConfig {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,11 +21,7 @@
|
||||
package io.kamax.mxisd.config.ldap.netiq;
|
||||
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "netiq")
|
||||
public class NetIqLdapConfig extends LdapConfig {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
|
||||
package io.kamax.mxisd.config.memory;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class MemoryIdentityConfig {
|
||||
|
||||
private String username;
|
||||
|
||||
@@ -20,17 +20,13 @@
|
||||
|
||||
package io.kamax.mxisd.config.memory;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("memory")
|
||||
public class MemoryStoreConfig {
|
||||
|
||||
private boolean enabled;
|
||||
private List<MemoryIdentityConfig> identities;
|
||||
private List<MemoryIdentityConfig> identities = new ArrayList<>();
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
@@ -48,4 +44,8 @@ public class MemoryStoreConfig {
|
||||
this.identities = identities;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
package io.kamax.mxisd.config.memory;
|
||||
|
||||
import io.kamax.matrix._ThreePid;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MemoryThreePid implements _ThreePid {
|
||||
|
||||
private String medium;
|
||||
|
||||
@@ -24,8 +24,6 @@ import io.kamax.mxisd.exception.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.net.MalformedURLException;
|
||||
@@ -33,8 +31,6 @@ import java.net.URL;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("rest")
|
||||
public class RestBackendConfig {
|
||||
|
||||
public static class IdentityEndpoints {
|
||||
@@ -133,7 +129,7 @@ public class RestBackendConfig {
|
||||
|
||||
}
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(RestBackendConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(RestBackendConfig.class);
|
||||
|
||||
private boolean enabled;
|
||||
private String host;
|
||||
|
||||
@@ -24,14 +24,13 @@ import io.kamax.mxisd.util.GsonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class SqlConfig {
|
||||
|
||||
private transient Logger log = LoggerFactory.getLogger(SqlConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(SqlConfig.class);
|
||||
|
||||
public static class Query {
|
||||
|
||||
@@ -283,7 +282,6 @@ public abstract class SqlConfig {
|
||||
|
||||
protected abstract String getProviderName();
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
if (getAuth().isEnabled() == null) {
|
||||
getAuth().setEnabled(isEnabled());
|
||||
|
||||
@@ -21,13 +21,7 @@
|
||||
package io.kamax.mxisd.config.sql.generic;
|
||||
|
||||
import io.kamax.mxisd.config.sql.SqlConfig;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("sql")
|
||||
@Primary
|
||||
public class GenericSqlProviderConfig extends SqlConfig {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,13 +23,7 @@ package io.kamax.mxisd.config.sql.synapse;
|
||||
import io.kamax.mxisd.backend.sql.synapse.SynapseQueries;
|
||||
import io.kamax.mxisd.config.sql.SqlConfig;
|
||||
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("synapseSql")
|
||||
public class SynapseSqlProviderConfig extends SqlConfig {
|
||||
|
||||
@Override
|
||||
@@ -37,8 +31,9 @@ public class SynapseSqlProviderConfig extends SqlConfig {
|
||||
return "Synapse SQL";
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void doBuild() {
|
||||
public void build() {
|
||||
super.build();
|
||||
|
||||
getAuth().setEnabled(false); // Synapse does the auth, we only act as a directory/identity service.
|
||||
|
||||
// FIXME check that the DB is not the mxisd one
|
||||
|
||||
@@ -24,15 +24,11 @@ import io.kamax.mxisd.util.GsonUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("notification.handlers.sendgrid")
|
||||
public class EmailSendGridConfig {
|
||||
|
||||
public static class EmailTemplate {
|
||||
@@ -172,7 +168,7 @@ public class EmailSendGridConfig {
|
||||
|
||||
}
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(EmailSendGridConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(EmailSendGridConfig.class);
|
||||
|
||||
private Api api = new Api();
|
||||
private Identity identity = new Identity();
|
||||
|
||||
@@ -23,16 +23,12 @@ package io.kamax.mxisd.config.threepid.connector;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "threepid.medium.email.connectors.smtp")
|
||||
public class EmailSmtpConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(EmailSmtpConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(EmailSmtpConfig.class);
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
|
||||
@@ -22,18 +22,14 @@ package io.kamax.mxisd.config.threepid.connector;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = PhoneTwilioConfig.NAMESPACE)
|
||||
public class PhoneTwilioConfig {
|
||||
|
||||
static final String NAMESPACE = "threepid.medium.msisdn.connectors.twilio";
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(PhoneTwilioConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(PhoneTwilioConfig.class);
|
||||
|
||||
private String accountSid;
|
||||
private String authToken;
|
||||
|
||||
@@ -26,18 +26,11 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("threepid.medium.email")
|
||||
public class EmailConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(EmailConfig.class);
|
||||
|
||||
public static class Identity {
|
||||
private String from;
|
||||
private String name;
|
||||
@@ -60,13 +53,14 @@ public class EmailConfig {
|
||||
|
||||
}
|
||||
|
||||
private transient final Logger log = LoggerFactory.getLogger(EmailConfig.class);
|
||||
|
||||
private String generator;
|
||||
private String connector;
|
||||
|
||||
private MatrixConfig mxCfg;
|
||||
private Identity identity = new Identity();
|
||||
|
||||
@Autowired
|
||||
public EmailConfig(MatrixConfig mxCfg) {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@@ -22,16 +22,12 @@ package io.kamax.mxisd.config.threepid.medium;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("threepid.medium.email.generators.template")
|
||||
public class EmailTemplateConfig extends GenericTemplateConfig {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(EmailTemplateConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(EmailTemplateConfig.class);
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
|
||||
@@ -24,16 +24,12 @@ import io.kamax.mxisd.exception.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("threepid.medium.msisdn")
|
||||
public class PhoneConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(PhoneConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(PhoneConfig.class);
|
||||
|
||||
private String generator;
|
||||
private String connector;
|
||||
|
||||
@@ -22,16 +22,12 @@ package io.kamax.mxisd.config.threepid.medium;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("threepid.medium.msisdn.generators.template")
|
||||
public class PhoneSmsTemplateConfig extends GenericTemplateConfig {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(EmailTemplateConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(EmailTemplateConfig.class);
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
|
||||
@@ -20,22 +20,20 @@
|
||||
|
||||
package io.kamax.mxisd.config.threepid.notification;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("notification")
|
||||
public class NotificationConfig {
|
||||
|
||||
private Logger log = LoggerFactory.getLogger(NotificationConfig.class);
|
||||
private transient final Logger log = LoggerFactory.getLogger(NotificationConfig.class);
|
||||
|
||||
private Map<String, String> handler = new HashMap<>();
|
||||
private Map<String, JsonObject> handlers = new HashMap<>();
|
||||
|
||||
public Map<String, String> getHandler() {
|
||||
return handler;
|
||||
@@ -45,13 +43,19 @@ public class NotificationConfig {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public Map<String, JsonObject> getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public void setHandlers(Map<String, JsonObject> handlers) {
|
||||
this.handlers = handlers;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void build() {
|
||||
log.info("--- Notification config ---");
|
||||
log.info("Handlers:");
|
||||
handler.forEach((k, v) -> {
|
||||
log.info("\t{}: {}", k, v);
|
||||
});
|
||||
handler.forEach((k, v) -> log.info("\t{}: {}", k, v));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,14 +22,10 @@ package io.kamax.mxisd.config.wordpress;
|
||||
|
||||
import io.kamax.mxisd.exception.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties("wordpress")
|
||||
public class WordpressConfig {
|
||||
|
||||
public static class Credential {
|
||||
|
||||
Reference in New Issue
Block a user