azure-maven-plugins icon indicating copy to clipboard operation
azure-maven-plugins copied to clipboard

Functions - "$ mvn package" goal should fill up local.setting.json for developers

Open selvasingh opened this issue 5 years ago • 3 comments

Plugin name and version

Azure Functions Plugin - Beta-6

Plugin configuration in your pom.xml

NA

Expected behavior

When developers run $ mvn package, the POM.xml file carries all the necessary app settings. The plugin can use them to populate local.settings.json file. This will make it easy for developers to run locally using $ mvn azure-functions:run

Actual behavior

Developers must manually populate local.settings.json file. This takes time and is error prone. We tried to automate by writing some scripts to populate local.settings.json and calling these scripts from package goal.

See examples: Script - https://github.com/Microsoft/inventory-hub-java-on-azure/blob/master/function-apps/Notify-Inventory/post-process-function.json.sh

Augment package goal - https://github.com/Microsoft/inventory-hub-java-on-azure/blob/master/function-apps/Notify-Inventory/pom.xml#L231

selvasingh avatar Oct 10 '18 21:10 selvasingh

Not sure if this is handy for local versus remote deployment.

nicenemo avatar Oct 12 '18 12:10 nicenemo

@nicenemo - this is for local deployment

selvasingh avatar Oct 17 '18 16:10 selvasingh

Gave this one some thought - I realized that the local tools actually follow the following behavior:

  1. Look for a value from the environment variables
  2. Look for a value in local.settings.json

With that said I think you can actually get exactly what you want with core tools today. You just need to make sure the name of the environment variables match what the code describes. In other words instead of needing to map:

EventHubConnectionString: "%MyEventHubConnectionString%", just have an environment variable in something like setup-env be EventHubConnectionString. Any reason you'd need the extra mapping step?

jeffhollan avatar Oct 18 '18 20:10 jeffhollan