You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by kd...@apache.org on 2018/06/13 18:22:37 UTC
nifi-registry git commit: NIFIREG-174 Fixing start-up to look for the
system properties specifying the location of properties and bootstrap,
and fallback to relative paths
Repository: nifi-registry
Updated Branches:
refs/heads/master aa8b4bec3 -> ee6c1f26b
NIFIREG-174 Fixing start-up to look for the system properties specifying the location of properties and bootstrap, and fallback to relative paths
This closes #124.
Signed-off-by: Kevin Doran <kd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi-registry/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-registry/commit/ee6c1f26
Tree: http://git-wip-us.apache.org/repos/asf/nifi-registry/tree/ee6c1f26
Diff: http://git-wip-us.apache.org/repos/asf/nifi-registry/diff/ee6c1f26
Branch: refs/heads/master
Commit: ee6c1f26b02d9907cb15960f27fd573a83f040c0
Parents: aa8b4be
Author: Bryan Bende <bb...@apache.org>
Authored: Wed Jun 13 12:16:37 2018 -0400
Committer: Kevin Doran <kd...@apache.org>
Committed: Wed Jun 13 14:22:22 2018 -0400
----------------------------------------------------------------------
.../nifi/registry/bootstrap/RunNiFiRegistry.java | 1 +
.../java/org/apache/nifi/registry/NiFiRegistry.java | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/ee6c1f26/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
----------------------------------------------------------------------
diff --git a/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java b/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
index c6d92ea..769d1c4 100644
--- a/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
+++ b/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
@@ -942,6 +942,7 @@ public class RunNiFiRegistry {
cmd.add(classPath);
cmd.addAll(javaAdditionalArgs);
cmd.add("-Dnifi.registry.properties.file.path=" + nifiRegistryPropsFilename);
+ cmd.add("-Dnifi.registry.bootstrap.config.file.path=" + bootstrapConfigFile.getAbsolutePath());
cmd.add("-Dnifi.registry.bootstrap.listen.port=" + listenPort);
cmd.add("-Dapp=NiFiRegistry");
cmd.add("-Dorg.apache.nifi.registry.bootstrap.config.log.dir=" + nifiRegistryLogDir);
http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/ee6c1f26/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java
----------------------------------------------------------------------
diff --git a/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java b/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java
index 43f8ecf..65fdcf4 100644
--- a/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java
+++ b/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java
@@ -42,8 +42,11 @@ public class NiFiRegistry {
public static final String BOOTSTRAP_PORT_PROPERTY = "nifi.registry.bootstrap.listen.port";
- public static final String REGISTRY_BOOTSTRAP_FILE_LOCATION = "conf/bootstrap.conf";
- public static final String REGISTRY_PROPERTIES_FILE_LOCATION = "conf/nifi-registry.properties";
+ public static final String NIFI_REGISTRY_PROPERTIES_FILE_PATH_PROPERTY = "nifi.registry.properties.file.path";
+ public static final String NIFI_REGISTRY_BOOTSTRAP_FILE_PATH_PROPERTY = "nifi.registry.bootstrap.config.file.path";
+
+ public static final String RELATIVE_BOOTSTRAP_FILE_LOCATION = "conf/bootstrap.conf";
+ public static final String RELATIVE_PROPERTIES_FILE_LOCATION = "conf/nifi-registry.properties";
private final JettyServer server;
private final BootstrapListener bootstrapListener;
@@ -147,8 +150,9 @@ public class NiFiRegistry {
final CryptoKeyProvider masterKeyProvider;
final NiFiRegistryProperties properties;
try {
- masterKeyProvider = new BootstrapFileCryptoKeyProvider(REGISTRY_BOOTSTRAP_FILE_LOCATION);
- LOGGER.info("Read property protection key from {}", REGISTRY_BOOTSTRAP_FILE_LOCATION);
+ final String bootstrapConfigFilePath = System.getProperty(NIFI_REGISTRY_BOOTSTRAP_FILE_PATH_PROPERTY, RELATIVE_BOOTSTRAP_FILE_LOCATION);
+ masterKeyProvider = new BootstrapFileCryptoKeyProvider(bootstrapConfigFilePath);
+ LOGGER.info("Read property protection key from {}", bootstrapConfigFilePath);
properties = initializeProperties(masterKeyProvider);
} catch (final IllegalArgumentException iae) {
throw new RuntimeException("Unable to load properties: " + iae, iae);
@@ -174,7 +178,8 @@ public class NiFiRegistry {
try {
try {
// Load properties using key. If properties are protected and key missing, throw RuntimeException
- NiFiRegistryProperties properties = NiFiRegistryPropertiesLoader.withKey(key).load(REGISTRY_PROPERTIES_FILE_LOCATION);
+ final String nifiRegistryPropertiesFilePath = System.getProperty(NIFI_REGISTRY_PROPERTIES_FILE_PATH_PROPERTY, RELATIVE_PROPERTIES_FILE_LOCATION);
+ final NiFiRegistryProperties properties = NiFiRegistryPropertiesLoader.withKey(key).load(nifiRegistryPropertiesFilePath);
LOGGER.info("Loaded {} properties", properties.size());
return properties;
} catch (SensitivePropertyProtectionException e) {