@Override public PropertySource load() { val properties = new LinkedHashMap<Object, Object>(); val slurper = new ConfigSlurper(); applicationProfiles.forEach(Unchecked.consumer(profile -> { slurper.setEnvironment(profile); slurper.registerConditionalBlock("profiles", profile); val bindings = CollectionUtils.wrap("profile", profile, "logger", LOGGER); slurper.setBinding(bindings); val groovyConfig = slurper.parse(getResource().getURL()); val pp = groovyConfig.toProperties(); LOGGER.debug("Found settings [{}] in Groovy file [{}]", pp.keySet(), getResource()); properties.putAll(pp); })); return finalizeProperties(decryptProperties(properties)); } }
URL url = loader.getResource(prefix + "/config/config.groovy"); ConfigObject co = null; ConfigSlurper cs = new ConfigSlurper(); if(url != null){ co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url));
@Override public void applyConfig(Map<String, String> m) { File configGroovy = Bootstrap.getInstance().resolveConfig("services.groovy"); logger.info("loading services from: {}", configGroovy); ConfigSlurper slurper = new ConfigSlurper(); if (Kernel.getExecutionProfile().isPresent()) { slurper.setEnvironment(Kernel.getExecutionProfile().get()); } if (configGroovy.exists()) { try { ConfigObject obj = slurper.parse(configGroovy.toURI().toURL()); Properties p = obj.toProperties(); p.entrySet().forEach(it -> { String key = Objects.toString(it.getKey()); String val = Objects.toString(it.getValue()); m.put(key, val); }); } catch (MalformedURLException e) { throw new MacGyverConfigurationException(e); } } else { logger.warn("services config file not found: {}", configGroovy); } }
/** load the bootstrap configuration */ private ConfigObject doBootstrap() { URL url = getClass().getClassLoader().getResource(BOOTSTRAP_FILE_NAME); String msg = String.format("Missing bootstrap file: %s. (Hint: copy " + "framework/test-contract/src/bootstrap.groovy to folder framework/test-contract/build)", BOOTSTRAP_FILE_NAME); assertNotNull(url, msg); return cs.parse(url); }
org.apache.log4j.PropertyConfigurator.configure( new ConfigSlurper().parse(new File("config.groovy").toURL()).toProperties())
URL url = loader.getResource(prefix + "/config/config.groovy"); ConfigObject co = null; ConfigSlurper cs = new ConfigSlurper(); if(url != null){ co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url));
/** load the bootstrap configuration */ private ConfigObject doBootstrap() { URL url = getClass().getClassLoader().getResource(BOOTSTRAP_FILE_NAME); String msg = String.format("Missing bootstrap file: %s. (Hint: copy " + "framework/test-contract/src/bootstrap.groovy to folder framework/test-contract/build)", BOOTSTRAP_FILE_NAME); Assert.assertNotNull(msg, url); return cs.parse(url); }
ConfigObject config = new ConfigSlurper().parse(new File("configuration").toURL()); Map flattenedConfig = config.flatten(); String oracleHost = (String) flattenedConfig.get("datastore.oracle.host");
URL url = loader.getResource(prefix + "/config/config.groovy"); ConfigObject co = null; ConfigSlurper cs = new ConfigSlurper(); if(url != null){ co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url)); co = mergeConfigObjects(co, cs.parse(url));
/** load the bootstrap configuration */ private ConfigObject doBootstrap() { URL url = getClass().getClassLoader().getResource(BOOTSTRAP_FILE_NAME); String msg = String.format("Missing bootstrap file: %s. (Hint: copy " + "framework/test-contract/src/bootstrap.groovy to folder framework/test-contract/build)", BOOTSTRAP_FILE_NAME); Assert.assertNotNull(msg, url); return cs.parse(url); }
ConfigSlurper configSlurper = new ConfigSlurper(); Properties properties = new Properties(); Map<String, Object> finalConfig = new LinkedHashMap<>(); ConfigObject configObject = configSlurper.parse(properties); ConfigObject flatConfigObject = new ConfigObject(); configObject.flatten(flatConfigObject);
/** * Constructor for JUnit Testing purposes only. Do not use it normally. */ GroovyDataProvider(URL configURL) { configObject = doBootstrap(); // parse the configuration file once ConfigObject highPriorityCO = cs.parse(configURL); configObject = mergeConfigObjects(configObject, highPriorityCO); }
/** * Constructor for JUnit Testing purposes only. Do not use it normally. */ GroovyDataProvider(URL configURL) { configObject = doBootstrap(); // parse the configuration file once ConfigObject highPriorityCO = cs.parse(configURL); configObject = mergeConfigObjects(configObject, highPriorityCO); }
/** * Constructor for JUnit Testing purposes only. Do not use it normally. */ GroovyDataProvider(URL configURL) { configObject = doBootstrap(); // parse the configuration file once ConfigObject highPriorityCO = cs.parse(configURL); configObject = mergeConfigObjects(configObject, highPriorityCO); }