I need to get env variable in my nifi processor. The only solution I found is to create Parameter Context with EnvironmentVariableParameterProvider. The problem here is that action should be done by user in nifi UI and then he could use them in expression, like ${SOME_ENV_VAR}
.
Are there any way to do get env var in my custom processor without any user actions in nifi UI?
Actually this is pretty easy. Expressions could be evaluated inside custom processor, and they could reference env variable https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#expression-language-hierarchy.
val someExpr = "${SOME_ENV_VAR}"
val result = context.newPropertyValue(someExpr).evaluateAttributeExpressions().getValue
SOME_ENV_VAR
is environment variable from system (or container)