in core/container/src/main/java/org/wildfly/swarm/Swarm.java [572:640]
private void initializeConfigView(Properties props) throws IOException, ModuleLoadException {
try (AutoCloseable handle = Performance.time("Loading YAML")) {
if (System.getProperty(SwarmProperties.PROJECT_STAGE_FILE) != null) {
String file = System.getProperty(SwarmProperties.PROJECT_STAGE_FILE);
boolean loaded = false;
try {
Path path = Paths.get(file);
if (Files.exists(path)) {
this.configView.load("stages", path.toUri().toURL());
loaded = true;
}
} catch (InvalidPathException e) {
// ignore
}
if (!loaded) {
// try it as a URL
try {
URL url = new URL(file);
this.configView.load("stages", url);
} catch (MalformedURLException e) {
// oh well
}
}
}
//List<String> activatedNames = new ArrayList<>();
String projectStageProp = System.getProperty(SwarmProperties.PROJECT_STAGE);
if (projectStageProp == null && props != null) {
projectStageProp = props.getProperty(SwarmProperties.PROJECT_STAGE);
}
if (projectStageProp == null) {
projectStageProp = this.configView.get().resolve(SwarmProperties.PROJECT_STAGE).withDefault("NOT_FOUND").getValue();
if (projectStageProp != null && projectStageProp.equals("NOT_FOUND")) {
projectStageProp = null;
}
}
if (projectStageProp != null) {
String[] activated = projectStageProp.split(",");
for (String each : activated) {
this.configView.load(each);
this.configView.withProfile(each);
}
}
int counter = 0;
for (URL config : this.configs) {
String syntheticName = "cli-" + (++counter);
this.configView.load(syntheticName, config);
this.configView.withProfile(syntheticName);
}
this.configView.load("stages");
for (String profile : this.profiles) {
this.configView.load(profile);
this.configView.withProfile(profile);
}
this.configView.load("defaults");
initializeConfigFilters();
} catch (Exception e) {
throw new RuntimeException(e);
}
}