Skip to content

Commit

Permalink
refactor load config from bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Jul 12, 2018
1 parent 4213295 commit 06080c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ public static String dataSourceParameterMapToYaml(final Map<String, DataSourcePa
@SuppressWarnings("unchecked")
public static Map<String, DataSourceParameter> dataSourceParameterMapFromYaml(final String dataSourceParameterMapYamlString) {
return (Map<String, DataSourceParameter>) YAML.load(dataSourceParameterMapYamlString);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,14 @@ private static void startWithoutRegistryCenter(final YamlProxyConfiguration conf

private static void startWithRegistryCenter(final YamlProxyConfiguration localConfig, final int port) throws InterruptedException, MalformedURLException {
try (OrchestrationFacade orchestrationFacade = new OrchestrationFacade(localConfig.getOrchestration().getOrchestrationConfiguration())) {
YamlProxyConfiguration config = getYamlProxyConfiguration(localConfig, orchestrationFacade);
orchestrationFacade.init(config);
if (!localConfig.isEmptyLocalConfiguration()) {
orchestrationFacade.init(localConfig);
}
YamlProxyConfiguration config = new YamlProxyConfiguration(orchestrationFacade.getConfigService().loadDataSources(), orchestrationFacade.getConfigService().loadProxyConfiguration());
RuleRegistry.getInstance().init(config);
ProxyEventBusInstance.getInstance().register(new YamlProxyConfiguration());
EventBusInstance.getInstance().register(new XaTransactionListener());
new ShardingProxy().start(port);
}
}

private static YamlProxyConfiguration getYamlProxyConfiguration(final YamlProxyConfiguration localConfig, final OrchestrationFacade orchestrationFacade) {
return localConfig.isEmptyLocalConfiguration()
? new YamlProxyConfiguration(orchestrationFacade.getConfigService().loadDataSources(), orchestrationFacade.getConfigService().loadProxyConfiguration()) : localConfig;
}
}

0 comments on commit 06080c5

Please sign in to comment.