[ 
https://issues.apache.org/jira/browse/NIFI-5573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610436#comment-16610436
 ] 

ASF GitHub Bot commented on NIFI-5573:
--------------------------------------

Github user lfrancke commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2985#discussion_r216626331
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi-env.sh
 ---
    @@ -16,16 +16,38 @@
     #    limitations under the License.
     #
     
    +# By default this file will unconditionally override whatever environment 
variables you have set
    +# and set them to defaults defined here.
    +# If you want to define your own versions outside of this script please 
set the environment variable
    +# NIFI_OVERRIDE_NIFIENV to "true". That will then use whatever variables 
you used outside of
    +# this script.
    +
     # The java implementation to use.
     #export JAVA_HOME=/usr/java/jdk1.8.0/
     
    -export NIFI_HOME=$(cd "${SCRIPT_DIR}" && cd .. && pwd)
    +setOrDefault() {
    +  declare envvar="$1" default="$2"
    +
    +  local res="$envvar"
    +  if [ -z "$envvar" ] || [ "$NIFI_OVERRIDE_NIFIENV" != "true" ]
    --- End diff --
    
    Sorry @pepov ! No worries at all. I'm on vacation and won't be back for 
another week. I'll get to it then. Your comments make sense. I just haven't 
gotten around to look at them in detail.


> Allow overriding of nifi-env.sh
> -------------------------------
>
>                 Key: NIFI-5573
>                 URL: https://issues.apache.org/jira/browse/NIFI-5573
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Lars Francke
>            Assignee: Lars Francke
>            Priority: Minor
>
> (as discussed in 
> https://lists.apache.org/thread.html/ddfbff7f371d47c6da013ff14e28bce3b353716653a01649a408d0ce@%3Cdev.nifi.apache.org%3E)
> Currently nifi-env.sh unconditionally sets NIFI_HOME, NIFI_PID_DIR, 
> NIFI_LOG_DIR and NIFI_ALLOW_EXPLICIT_KEYTAB so they can only be overridden by 
> changing nifi-env.sh.
> Other *-env.sh files I looked at (e.g. from Hadoop or HBase) have most/all 
> their settings commented out or only override variables if they have not 
> already been set outside of the *-env.sh script.
> Peter and [~joewitt] witt from the mailing list are in favor of keeping the 
> current behavior of the file unchanged due to the fear that it might break 
> something for some people out there.
> There are a few different options I can think of on how to work around this:
>  # Have another environment variable NIFI_DISABLE_NIFIENV that basically 
> exits the nifi-env.sh script if it's set
>  # NIFI_OVERRIDE_NIFIENV which - if set to true - allows externally set 
> environment variables to override the ones in nifi-env.sh
> I'm sure there are more but those are the ones I can think of now.
> I'm in favor of option 2 as that allows me to selectively use the defaults 
> from nifi-env.sh
>  
> I can provide a patch once we've agreed on a way to go forward.
>  
> This would help me tremendously in an environment where I cannot easily alter 
> the nifi-env.sh file. This is also useful in the Docker image which currently 
> wipes out the nifi-env.sh script so its own environment variable take effect.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to