Search in sources :

Example 1 with Gateway

use of io.kamax.mxgwd.model.Gateway in project mxgwd by kamax-io.

the class UndertowApp method main.

public static void main(String[] args) throws IOException {
    String cfgFile = StringUtils.defaultIfBlank(System.getenv("MXGWD_CONFIG_FILE"), "mxgwd.yaml");
    Config cfg = Value.get(YamlConfigLoader.loadFromFile(cfgFile), Config::new);
    Gateway gw = new Gateway(cfg);
    CatchAllHandler allHandler = new CatchAllHandler(gw);
    ActivePoliciesListingHandler activePolicies = new ActivePoliciesListingHandler(gw);
    Undertow server = Undertow.builder().addHttpListener(cfg.getServer().getPort(), "0.0.0.0").setHandler(Handlers.path().addExactPath("/_matrix/client/r0/policy/policies", activePolicies).addPrefixPath("/", allHandler)).build();
    server.start();
}
Also used : Config(io.kamax.mxgwd.config.Config) Gateway(io.kamax.mxgwd.model.Gateway) Undertow(io.undertow.Undertow)

Aggregations

Config (io.kamax.mxgwd.config.Config)1 Gateway (io.kamax.mxgwd.model.Gateway)1 Undertow (io.undertow.Undertow)1