Github user dsbos commented on a diff in the pull request:
https://github.com/apache/drill/pull/93#discussion_r34650500
--- Diff:
common/src/main/java/org/apache/drill/common/config/DrillConfig.java ---
@@ -138,34 +155,77 @@ public static DrillConfig create(Properties
testConfigurations) {
return create(null, testConfigurations, true);
}
- public static DrillConfig create(String overrideFileName, boolean
enableServerConfigs) {
- return create(overrideFileName, null, enableServerConfigs);
+ /**
+ * ...
+ * @param overrideFileResourcePathname
+ * see {@link #create(String)}'s {@code
overrideFileResourcePathname}
+ */
+ public static DrillConfig create(String overrideFileResourcePathname,
boolean enableServerConfigs) {
+ return create(overrideFileResourcePathname, null, enableServerConfigs);
}
- private static DrillConfig create(String overrideFileName, Properties
overriderProps, boolean enableServerConfigs) {
- overrideFileName = overrideFileName == null ?
CommonConstants.CONFIG_OVERRIDE : overrideFileName;
-
- // first we load defaults.
+ /**
+ * ...
+ * @param overrideFileResourcePathname
+ * see {@link #create(String)}'s {@code
overrideFileResourcePathname}
+ * @param overriderProps
+ * optional property map for further overriding (after override
file
+ * is assimilated
+ * @param enableServerConfigs
+ * whether to enable server-specific configuration options
+ * @return
+ */
+ private static DrillConfig create(String overrideFileResourcePathname,
+ final Properties overriderProps,
+ final boolean enableServerConfigs) {
+ overrideFileResourcePathname =
+ overrideFileResourcePathname == null
+ ? CommonConstants.CONFIG_OVERRIDE
+ : overrideFileResourcePathname;
+
+ // 1. Load defaults configuration file.
Config fallback = null;
final ClassLoader[] classLoaders = ClasspathHelper.classLoaders();
for (ClassLoader classLoader : classLoaders) {
- if (classLoader.getResource(CommonConstants.CONFIG_DEFAULT) != null)
{
- fallback = ConfigFactory.load(classLoader,
CommonConstants.CONFIG_DEFAULT);
+ final URL url =
+ classLoader.getResource(CommonConstants.CONFIG_DEFAULT);
+ if (null != url) {
+ logger.debug("Loading base config. file at {}.", url);
+ fallback =
+ ConfigFactory.load(classLoader,
+ CommonConstants.CONFIG_DEFAULT);
break;
}
}
+ // 2. Load per-module configuration files.
Collection<URL> urls = PathScanner.getConfigURLs();
logger.debug("Loading configs at the following URLs {}", urls);
for (URL url : urls) {
+ logger.debug("Loading module config. file at {}.", url);
fallback = ConfigFactory.parseURL(url).withFallback(fallback);
}
- Config effectiveConfig =
ConfigFactory.load(overrideFileName).withFallback(fallback);
+ // 3. Load any overrides configuration file and overrides from JVM
--- End diff --
That "overrides" is part of the noun phrase "overrides configuration file"
(parallel to "defaults configuration file" and "per-module configuration file")
(not a reference to the overrides from any such file).
Yes, it's a bit ambiguous between meaning that and seeming like a word is
missing if one doesn't see the other phrases. (Changing the "any" to "the"
might reduce that ambiguity, but then it would imply that that code expects
there to be an overrides configuration file, when it's actually optional.)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---