public static Profile lookup ( String name , File directory ) throws IOException { // First check from the classpath, these profiles are used as a basis List < Profile > profiles = readProfileFromClasspath ( name ) ; File profileFile = findProfileYaml ( directory ) ; if ( profileFile != null ) { List < Profile > fileProfiles = fromYaml ( new FileInputStream ( profileFile ) ) ; for ( Profile profile : fileProfiles ) { if ( profile . getName ( ) . equals ( name ) ) { profiles . add ( profile ) ; break ; } } } // "larger" orders are "earlier" in the list Collections . sort ( profiles , Collections . < Profile > reverseOrder ( ) ) ; return mergeProfiles ( profiles ) ; }
Lookup profiles from a given directory and merge it with a profile of the same name found in the classpath