dsmiley commented on code in PR #3512:
URL: https://github.com/apache/solr/pull/3512#discussion_r2307467414
##########
solr/core/src/java/org/apache/solr/core/ConfigSetService.java:
##########
@@ -122,15 +116,19 @@ private void bootstrapDefaultConf() throws IOException {
}
private void bootstrapConfDir(String confDir) throws IOException {
- Path configPath = Path.of(confDir);
+ if (!confDir.endsWith("conf")) {
Review Comment:
Why mandate this? People should be able to put their conf on disk wherever
they want.
##########
solr/core/src/java/org/apache/solr/core/ConfigSetService.java:
##########
@@ -122,15 +116,19 @@ private void bootstrapDefaultConf() throws IOException {
}
private void bootstrapConfDir(String confDir) throws IOException {
- Path configPath = Path.of(confDir);
+ if (!confDir.endsWith("conf")) {
+ throw new IllegalArgumentException(
+ "solr.configset.bootstrap.confdir must point to 'conf' directory,
confDir: " + confDir);
+ }
+
+ Path configPath = resolvePathWithSolrInstallDir(confDir);
+
if (!Files.isDirectory(configPath)) {
throw new IllegalArgumentException(
- "bootstrap_confdir must be a directory of configuration files,
configPath: "
+ "solr.configset.bootstrap.confdir must be a directory of
configuration files, configPath: "
+ configPath);
}
- String confName =
- System.getProperty(
- ZkController.COLLECTION_PARAM_PREFIX +
ZkController.CONFIGNAME_PROP, "configuration1");
+ String confName = System.getProperty("solr.collection.config.name",
"configuration1");
Review Comment:
again; EnvUtils
##########
solr/core/src/java/org/apache/solr/core/ConfigSetService.java:
##########
@@ -85,22 +84,17 @@ private static ConfigSetService instantiate(CoreContainer
coreContainer) {
}
private void bootstrapConfigSet(CoreContainer coreContainer) {
- // bootstrap _default conf, bootstrap_confdir and bootstrap_conf if
provided via system property
+ // bootstrap _default conf and solr.configset.bootstrap.confdir if
specified.
try {
// _default conf
bootstrapDefaultConf();
- // bootstrap_confdir
- String confDir = System.getProperty("bootstrap_confdir");
+ // solr.configset.bootstrap.confdir
+ String confDir = System.getProperty("solr.configset.bootstrap.confdir");
Review Comment:
no EnvUtils? It would get us ENV var usage which is highly desirable for
these
##########
solr/core/src/java/org/apache/solr/core/ConfigSetService.java:
##########
@@ -164,6 +162,32 @@ public static Path getDefaultConfigDirPath() {
return null;
}
+ /**
+ * Resolves a path string into a Path object, handling both absolute and
relative paths. If the
+ * path is relative and solr.install.dir system property is set, the path is
resolved against the
+ * Solr installation directory. Otherwise, it's converted to an absolute
path based on the current
+ * working directory.
+ *
+ * @param pathStr The path string to resolve
+ * @return The resolved Path object
Review Comment:
you can say it's absolute and normalized
##########
solr/core/src/java/org/apache/solr/core/ConfigSetService.java:
##########
@@ -164,6 +162,32 @@ public static Path getDefaultConfigDirPath() {
return null;
}
+ /**
+ * Resolves a path string into a Path object, handling both absolute and
relative paths. If the
+ * path is relative and solr.install.dir system property is set, the path is
resolved against the
+ * Solr installation directory. Otherwise, it's converted to an absolute
path based on the current
+ * working directory.
+ *
+ * @param pathStr The path string to resolve
+ * @return The resolved Path object
+ * @see SolrDispatchFilter#SOLR_INSTALL_DIR_ATTRIBUTE
+ */
+ public static Path resolvePathWithSolrInstallDir(String pathStr) {
+ Path path = Path.of(pathStr);
+
+ // Convert to absolute path if it's relative and solr.install.dir is set
+ if (!path.isAbsolute()) {
+ String installDir =
System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE);
Review Comment:
Can we mandate that this system property is set? In the context of use of
this utility method, I think/hope that's reasonable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]