@Test public void loadConfigForAppIdAndEnvironment_works_as_expected() { // when Config config = TypesafeConfigUtil.loadConfigForAppIdAndEnvironment("typesafeconfigserver", "compiletimetest"); // then assertThat(config.getString("typesafeConfigServer.foo")).isEqualTo("overridevalue"); }
/** * Initializes the Typesafe Config system and configures the Netty leak detection level (if necessary). * DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server. */ protected void infrastructureInit() { MainClassUtils.setupJbossLoggingToUseSlf4j(); Pair<String, String> appIdAndEnvironmentPair = getAppIdAndEnvironmentPair(); Config appConfig = TypesafeConfigUtil .loadConfigForAppIdAndEnvironment(appIdAndEnvironmentPair.getLeft(), appIdAndEnvironmentPair.getRight()); MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled(appConfig::hasPath, (path) -> appConfig.getAnyRef(path).toString(), appConfig.entrySet().stream() .map(Map.Entry::getKey) .collect(Collectors.toList()), false); MainClassUtils.setupNettyLeakDetectionLevel(appConfig::hasPath, appConfig::getString); setAppConfig(appConfig); }