Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setAppSettings has no effect on values that can be set in local.settings.json #190

Open
Lesrac opened this issue Nov 19, 2024 · 0 comments

Comments

@Lesrac
Copy link

Lesrac commented Nov 19, 2024

Variables in the appSettings seem to be not applied to the locally run function.
Changes in "localDebug" have an effect on the locally run function.

Consider this configuration:

azurefunctions  {
    appName = project.name
    localDebug = "transport=dt_socket,server=y,suspend=n,address=5005"
    setRuntime(closureOf<com.microsoft.azure.gradle.configuration.GradleRuntimeConfig> {
        os("linux")
    })
    setAppSettings(closureOf<MutableMap<String, String>> {
        put("FUNCTIONS_WORKER_RUNTIME", "python")
        put("JAVA_OPTS", "-Djdk.net.hosts.file=/path/src/test/resources/test_hosts")
    })
}

When executing "gradlew azureFunctionsRun" then no java environment variable or system property is set for "jdk.net.hosts.file" and the log states "FUNCTIONS_WORKER_RUNTIME set to java." - which is the config for FUNCTIONS_WORKER_RUNTIME that is set in the local.settings.json.

Example local.settings.json file:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "java",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "AzureFunctionsJobHost__logging__logLevel__default": "Information",
    "AzureFunctionsJobHost__logging__logLevel__Function": "Information",
    "MAIN_CLASS": "com.Functions",
    "AzureWebJobsStorage": ""
  }
}

My expectation would be that the "setAppSettings" would work locally and replace values that are set in the local.settings.json.
Is this a bug or is this the intended behaviour? (in which case a comment in the wiki would be appreciated)

Gradle version: 8.10.2
Azure gradle plugin version: 1.16.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant