Skip to content

Commit 83d5388

Browse files
committed
Add app setting name in constants file
1 parent 1e53683 commit 83d5388

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/main/java/com/microsoft/azure/functions/worker/Constants.java

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ private Constants(){}
99
public final static String JAVA_LIBRARY_DIRECTORY = "/annotationLib";
1010
public final static String JAVA_LIBRARY_ARTIFACT_ID = "azure-functions-java-library";
1111
public final static String HAS_IMPLICIT_OUTPUT_QUALIFIED_NAME = "com.microsoft.azure.functions.annotation.HasImplicitOutput";
12+
public final static String NULLABLE_VALUES_ENABLED_APP_SETTING = "FUNCTIONS_WORKER_NULLABLE_VALUES_ENABLED";
1213
}

src/main/java/com/microsoft/azure/functions/worker/binding/RpcHttpRequestDataSource.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.stream.Collectors;
1010

1111
import com.microsoft.azure.functions.rpc.messages.NullableTypes;
12+
import com.microsoft.azure.functions.worker.Constants;
1213
import com.microsoft.azure.functions.worker.Util;
1314
import org.apache.commons.lang3.reflect.TypeUtils;
1415

@@ -93,7 +94,7 @@ public Builder createResponseBuilder(HttpStatus status) {
9394
}
9495

9596
private static Map<String, String> convertFromNullableMap(Map<String, NullableTypes.NullableString> nullableMap) {
96-
if (Util.isTrue(System.getenv("FUNCTIONS_WORKER_NULLABLE_VALUES_ENABLED"))) {
97+
if (Util.isTrue(System.getenv(Constants.NULLABLE_VALUES_ENABLED_APP_SETTING))) {
9798
return nullableMap.entrySet().stream().collect(
9899
Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getValue())
99100
);

src/test/java/com/microsoft/azure/functions/worker/binding/tests/RpcHttpRequestDataSourceTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.microsoft.azure.functions.HttpStatus;
1212
import com.microsoft.azure.functions.rpc.messages.RpcHttp;
1313
import com.microsoft.azure.functions.rpc.messages.TypedData;
14+
import com.microsoft.azure.functions.worker.Constants;
1415
import com.microsoft.azure.functions.worker.binding.*;
1516
import com.microsoft.azure.functions.worker.broker.JavaFunctionBroker;
1617
import com.microsoft.azure.functions.worker.handler.FunctionEnvironmentReloadRequestHandler;
@@ -63,7 +64,7 @@ public void rpcHttpDataSourceToHttpRequestMessageEnvSettingEnabled() throws Exce
6364
Map<String, String> existingVariables = System.getenv();
6465
Map<String, String> newEnvVariables = new HashMap<>();
6566
newEnvVariables.putAll(existingVariables);
66-
newEnvVariables.put("FUNCTIONS_WORKER_NULLABLE_VALUES_ENABLED", "true");
67+
newEnvVariables.put(Constants.NULLABLE_VALUES_ENABLED_APP_SETTING, "true");
6768
envHandler.setEnv(newEnvVariables);
6869
Method httpRequestMessageStringBodyMethod = getFunctionMethod("HttpRequestStringBody");
6970
Map<String, String> queryMap = new HashMap<String, String>() {{
@@ -97,7 +98,7 @@ public void rpcHttpDataSourceToHttpRequestMessageEnvSettingDisabled() throws Exc
9798
Map<String, String> existingVariables = System.getenv();
9899
Map<String, String> newEnvVariables = new HashMap<>();
99100
newEnvVariables.putAll(existingVariables);
100-
newEnvVariables.put("FUNCTIONS_WORKER_NULLABLE_VALUES_ENABLED", "false");
101+
newEnvVariables.put(Constants.NULLABLE_VALUES_ENABLED_APP_SETTING, "false");
101102
envHandler.setEnv(newEnvVariables);
102103
Method httpRequestMessageStringBodyMethod = getFunctionMethod("HttpRequestStringBody");
103104
Map<String, String> queryMap = new HashMap<String, String>() {{

0 commit comments

Comments
 (0)