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