Skip to content

Commit

Permalink
Change RoqDataConfig as interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mcruzdev committed Jun 26, 2024
1 parent 6b1d953 commit 0bb765a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.stream.Stream;

import io.quarkiverse.roq.data.deployment.items.RoqDataJsonBuildItem;
import io.quarkiverse.roq.data.runtime.RoqDataConfig;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.runtime.util.ClassPathUtils;
Expand All @@ -19,14 +20,14 @@
public class ReadRoqDataProcessor {

private static final String META_INF_RESOURCES = "META-INF/resources";
private static final Set<String> YAML_EXTENSIONS = Set.of(".yaml", ".yml");
private static final Set<String> SUPPORTED_EXTENSIONS = Set.of(".json", ".yaml", ".yml");

RoqDataConfig roqDataConfig;

@BuildStep
void scanDataFiles(BuildProducer<RoqDataJsonBuildItem> dataProducer,
RoqDataConfig roqDataConfig) {
void scanDataFiles(BuildProducer<RoqDataJsonBuildItem> dataProducer) {
try {
Set<RoqDataJsonBuildItem> items = scanDataFiles(roqDataConfig.location);
Set<RoqDataJsonBuildItem> items = scanDataFiles(this.roqDataConfig.location());

for (RoqDataJsonBuildItem item : items) {
dataProducer.produce(item);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.quarkiverse.roq.data.runtime;

import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigMapping(prefix = "quarkus.roq.data")
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public interface RoqDataConfig {

String DEFAULT_LOCATION = "data";

/**
* The location of the Roq data files.
*/
@WithDefault(DEFAULT_LOCATION)
String location();
}

0 comments on commit 0bb765a

Please sign in to comment.