@Override public void start() throws AppLifecycleException { Logger logger = LoggerFactory.getLogger(getClass()); logger.info("STARTUP/begin: Alias initialization"); String baseUrl = config.getIndyUrl(); if (!isEmpty(baseUrl)) { logger.info("Retrieving endpoints from Indy at: {} in order to auto-alias...", baseUrl); try { Indy indy = new Indy(baseUrl).connect(); EndpointViewListing endpoints = indy.stats().getAllEndpoints(); for (EndpointView epv : endpoints.getItems()) { logger.info("Alias Indy '{}' => {}", epv.getKey(), epv.getResourceUri()); sourceManager.addSourceAlias(epv.getKey(), epv.getResourceUri()); } } catch (IndyClientException e) { throw new AppLifecycleException( "Failed to read repositories from Indy at: %s. Reason: %s", e, baseUrl, e.getMessage()); } catch (CartoException e) { throw new AppLifecycleException( "Failed to add alias from Indy at: %s. Reason: %s", e, baseUrl, e.getMessage()); } } else { logger.info("No Indy server configured. Skipping auto-aliasing step."); } Map<String, String> explicitAliases = config.getExplicitAliases(); List<String> errors = new ArrayList<>(); if (explicitAliases != null) { logger.info("Adding explicit aliases from configuration..."); explicitAliases.forEach( (alias, url) -> { logger.info("Alias '{}' => {}", alias, url); try { sourceManager.addSourceAlias(alias, url); } catch (CartoException e) { errors.add(String.format("%s -> %s (Reason: %s)", e, alias, url, e.getMessage())); } }); } if (!errors.isEmpty()) { throw new AppLifecycleException( "Failed to add aliases:\n %s", StringUtils.join(errors, "\n ")); } logger.info("STARTUP/done: Alias initialization complete."); }