NIFI-11057 Added Registry NAR Provider Variable for Docker

This closes #6847

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Dominique Jean-Prost 2023-01-13 17:34:44 +01:00 committed by exceptionfactory
parent 4f91420cc1
commit 8198ab5cbd
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
2 changed files with 25 additions and 4 deletions

View File

@ -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

View File

@ -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