use of com.artipie.repo.ConfigFile in project artipie by artipie.
the class VertxMain method startRepos.
/**
* Start repository servers.
*
* @param settings Settings.
* @param metrics Metrics.
*/
private void startRepos(final Settings settings, final Metrics metrics) {
final Storage storage = settings.repoConfigsStorage();
final Collection<RepoConfig> configs = storage.list(Key.ROOT).thenApply(keys -> keys.stream().map(key -> new ConfigFile(key)).filter(Predicate.not(ConfigFile::isSystem).and(ConfigFile::isYamlOrYml)).map(ConfigFile::name).map(name -> new RepositoriesFromStorage(this.http, storage).config(name)).map(stage -> stage.toCompletableFuture().join()).collect(Collectors.toList())).toCompletableFuture().join();
for (final RepoConfig repo : configs) {
try {
repo.port().ifPresent(prt -> {
final String name = new ConfigFile(repo.name()).name();
this.listenOn(new ArtipieRepositories(this.http, settings).slice(new Key.From(name), true), metrics, prt);
Logger.info(VertxMain.class, "Artipie repo '%s' was started on port %d", name, prt);
});
} catch (final IllegalStateException err) {
Logger.error(this, "Invalid repo config file %s: %[exception]s", repo.name(), err);
}
}
new QuartzScheduler(configs).start();
}
Aggregations