Commit 14f6192e authored by iwakeh's avatar iwakeh Committed by Karsten Loesing
Browse files

Add system property for all paths.

The system property is 'onionoo.basedir'.  If not set, backwards compatible
defaults apply.  Implements task-14201.
parent 32992eea
......@@ -9,6 +9,10 @@
- Switch from our own CollecTor downloader to metrics-lib's
DescriptorCollector.
* Minor changes
- Add a new Java property "onionoo.basedir" to re-configure the
base directory used by the web server component.
# Changes in version 4.0-1.3.0 - 2017-08-04
......
......@@ -22,8 +22,7 @@ import java.util.concurrent.TimeUnit;
/* Update search data and status data files. */
public class Main implements Runnable {
private Main() {
}
private Main() {}
private Logger log = LoggerFactory.getLogger(Main.class);
......
......@@ -20,7 +20,6 @@ import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
......@@ -31,11 +30,11 @@ public class NodeIndexer implements ServletContextListener, Runnable {
@Override
public void contextInitialized(ServletContextEvent contextEvent) {
ServletContext servletContext = contextEvent.getServletContext();
File outDir = new File(servletContext.getInitParameter("outDir"));
File outDir = new File(System.getProperty("onionoo.basedir",
"/srv/onionoo.torproject.org/onionoo"), "out");
if (!outDir.exists() || !outDir.isDirectory()) {
log.error("\n\n\tOut-dir not found! Expected directory: " + outDir
+ "\n\tVerify the configuration in ./etc/web.xml.template");
+ "\n\tSet system property 'onionoo.basedir'.");
System.exit(1);
}
DocumentStore documentStore = DocumentStoreFactory.getDocumentStore();
......
......@@ -41,11 +41,6 @@
<url-pattern>/uptime</url-pattern>
</servlet-mapping>
<context-param>
<param-name>outDir</param-name>
<param-value>/srv/onionoo.torproject.org/onionoo/out/</param-value>
</context-param>
<listener>
<listener-class>
org.torproject.onionoo.server.NodeIndexer
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment