diff --git a/CHANGELOG.md b/CHANGELOG.md
index 776a79bca5..0ebce43dc4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added locationByDeepCoverageZone to the `crs/stats/ip/{ip}` endpoint in the Traffic Router API
### Fixed
-- Fixed #5274 - CDN in a Box's Traffic Vault image failed to build due to Basho's repo responding with 402 Payment Required. The repo has been removed from the image.
+- [#5274](https://github.com/apache/trafficcontrol/issues/5274) - CDN in a Box's Traffic Vault image failed to build due
+ to Basho's repo responding with 402 Payment Required. The repo has been removed from the image.
+- [#5069](https://github.com/apache/trafficcontrol/issues/5069) - For LetsEncryptDnsChallengerWatcher in Traffic Router,
+ the cr-config location is configurable instead of only looking at `/opt/traffic_router/db/cr-config.json`
## [5.0.0] - 2020-10-20
### Added
diff --git a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
index d568085bb8..f009f6a893 100644
--- a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
+++ b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/ds/LetsEncryptDnsChallengeWatcher.java
@@ -29,6 +29,7 @@
import org.apache.log4j.Logger;
import java.io.*;
+import java.nio.file.Path;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
@@ -36,13 +37,10 @@
public class LetsEncryptDnsChallengeWatcher extends AbstractResourceWatcher {
private static final Logger LOGGER = Logger.getLogger(LetsEncryptDnsChallengeWatcher.class);
public static final String DEFAULT_LE_DNS_CHALLENGE_URL = "https://${toHostname}/api/2.0/letsencrypt/dnsrecords/";
- private static final String configFile = "/opt/traffic_router/db/cr-config.json";
+ private String configFile;
private ConfigHandler configHandler;
-
- public void setConfigHandler(final ConfigHandler configHandler) {
- this.configHandler = configHandler;
- }
+ private Path databasesDirectory;
public LetsEncryptDnsChallengeWatcher() {
setDatabaseUrl(DEFAULT_LE_DNS_CHALLENGE_URL);
@@ -134,7 +132,7 @@ public String getWatcherConfigPrefix() {
private String readConfigFile() {
try {
- final InputStream is = new FileInputStream(configFile);
+ final InputStream is = new FileInputStream(databasesDirectory.resolve(configFile).toString());
final BufferedReader buf = new BufferedReader(new InputStreamReader(is));
String line = buf.readLine();
final StringBuilder sb = new StringBuilder();
@@ -144,7 +142,7 @@ private String readConfigFile() {
}
return sb.toString();
} catch (Exception e) {
- LOGGER.error("Could not read cr-config file.");
+ LOGGER.error("Could not read cr-config file " + configFile + ".");
return null;
}
}
@@ -178,4 +176,18 @@ private ArrayNode updateStaticEntries(final LetsEncryptDnsChallenge challenge, f
return newStaticDnsEntriesNode;
}
+ public void setConfigHandler(final ConfigHandler configHandler) {
+ this.configHandler = configHandler;
+ }
+ public ConfigHandler getConfigHandler() {
+ return this.configHandler;
+ }
+
+ public void setDatabasesDirectory(final Path databasesDirectory) {
+ this.databasesDirectory = databasesDirectory;
+ }
+
+ public void setConfigFile(final String configFile) {
+ this.configFile = configFile;
+ }
}
diff --git a/traffic_router/core/src/main/webapp/WEB-INF/applicationContext.xml b/traffic_router/core/src/main/webapp/WEB-INF/applicationContext.xml
index 544cf55a18..55ef754d61 100644
--- a/traffic_router/core/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/traffic_router/core/src/main/webapp/WEB-INF/applicationContext.xml
@@ -89,14 +89,15 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+