use of io.kamax.mxgwd.config.Config 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();
}
use of io.kamax.mxgwd.config.Config in project mxgwd by kamax-io.
the class YamlConfigLoader method loadFromFile.
public static Config loadFromFile(String path) throws IOException {
Representer rep = new Representer();
rep.getPropertyUtils().setAllowReadOnlyProperties(true);
rep.getPropertyUtils().setSkipMissingProperties(true);
Yaml yaml = new Yaml(new Constructor(Config.class), rep);
Object o = yaml.load(new FileInputStream(path));
return GsonUtil.get().fromJson(GsonUtil.get().toJson(o), Config.class);
}
Aggregations