You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/02/03 22:24:05 UTC
[nifi] branch main updated: NIFI-11057 Added Registry NAR Provider Variable for Docker
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 8198ab5cbd NIFI-11057 Added Registry NAR Provider Variable for Docker
8198ab5cbd is described below
commit 8198ab5cbd728e48fd7472b4fb6aac13d5ad40cd
Author: Dominique Jean-Prost <dj...@gmail.com>
AuthorDate: Fri Jan 13 17:34:44 2023 +0100
NIFI-11057 Added Registry NAR Provider Variable for Docker
This closes #6847
Signed-off-by: David Handermann <ex...@apache.org>
---
nifi-docker/dockerhub/sh/common.sh | 22 ++++++++++++++++++----
nifi-docker/dockerhub/sh/start.sh | 7 +++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/nifi-docker/dockerhub/sh/common.sh b/nifi-docker/dockerhub/sh/common.sh
index f3ea43580e..d78aec494c 100755
--- a/nifi-docker/dockerhub/sh/common.sh
+++ b/nifi-docker/dockerhub/sh/common.sh
@@ -19,14 +19,28 @@
# 3 - file to perform replacement inline
prop_replace () {
target_file=${3:-${nifi_props_file}}
- echo 'replacing target file ' ${target_file}
+ echo "File [${target_file}] replacing [${1}]"
sed -i -e "s|^$1=.*$|$1=$2|" ${target_file}
}
uncomment() {
- target_file=${2}
- echo "Uncommenting ${target_file}"
- sed -i -e "s|^\#$1|$1|" ${target_file}
+ target_file=${2}
+ echo "File [${target_file}] uncommenting [${1}]"
+ sed -i -e "s|^\#$1|$1|" ${target_file}
+}
+
+# 1 - property key to add or replace
+# 2 - property value to use
+# 3 - file to perform replacement inline
+prop_add_or_replace () {
+ target_file=${3:-${nifi_props_file}}
+ property_found=$(awk -v property="${1}" 'index($0, property) == 1')
+ if [ -z "${property_found}" ]; then
+ echo "File [${target_file}] adding [${1}]"
+ echo "$1=$2" >> ${target_file}
+ else
+ prop_replace $1 $2 $3
+ fi
}
# NIFI_HOME is defined by an ENV command in the backing Dockerfile
diff --git a/nifi-docker/dockerhub/sh/start.sh b/nifi-docker/dockerhub/sh/start.sh
index 40b33a33ae..869a8e41b5 100755
--- a/nifi-docker/dockerhub/sh/start.sh
+++ b/nifi-docker/dockerhub/sh/start.sh
@@ -97,6 +97,13 @@ prop_replace 'nifi.analytics.connection.model.implementation' "${NIFI_ANALYTIC
prop_replace 'nifi.analytics.connection.model.score.name' "${NIFI_ANALYTICS_MODEL_SCORE_NAME:-rSquared}"
prop_replace 'nifi.analytics.connection.model.score.threshold' "${NIFI_ANALYTICS_MODEL_SCORE_THRESHOLD:-.90}"
+# Add NAR provider properties
+# nifi-registry NAR provider
+if [ -n "${NIFI_NAR_LIBRARY_PROVIDER_NIFI_REGISTRY_URL}" ]; then
+ prop_add_or_replace 'nifi.nar.library.provider.nifi-registry.implementation' 'org.apache.nifi.registry.extension.NiFiRegistryExternalResourceProvider'
+ prop_add_or_replace 'nifi.nar.library.provider.nifi-registry.url' "${NIFI_NAR_LIBRARY_PROVIDER_NIFI_REGISTRY_URL}"
+fi
+
if [ -n "${NIFI_SENSITIVE_PROPS_KEY}" ]; then
prop_replace 'nifi.sensitive.props.key' "${NIFI_SENSITIVE_PROPS_KEY}"
fi