azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

Support a way to commit a local.settings.json template to source control

Open anthonychu opened this issue 4 years ago • 7 comments

Currently, local.settings.json can contain secrets and it should not be added to source control (we add it to .gitignore by default).

Would be great to be able to commit a template to source control and Core Tools (and VS Code) can use it to generate a local.settings.json.

For example, a repo can include a local.settings.sample.json or local.settings.template.json (actual name TBD, maybe support multiple names), and if one doesn't exist, Core Tools can automatically copy it to local.settings.json on func start or func init and let the user know that it has done that.

In addition, Core tools can add more gestures or automation. For example, it could provide a way to sync the template (something like func settings sync) that takes entries in local.settings.json that are missing in the template and adds them to the template as empty strings. It can also take what's in the template and missing from local.settings.json and copy them the other way too (in this case, copy the actual values).

/cc @ijoosong

anthonychu avatar Jul 01 '20 21:07 anthonychu

@apawast @ankitkumarr Let's discuss in the next triage if this is something we can do.

anthonychu avatar Aug 06 '20 23:08 anthonychu

hi @apawast and @ankitkumarr let me know if there are any further plans for this. Thanks!

ijoosong avatar Sep 10 '20 23:09 ijoosong

I recently created a starter kit for ASWA/Functions. One of the key components is the ability to connect to a database, which requires a couple of settings of course. It would be wonderful to have the ability to create an empty local.settings.json file with a click rather than a clunky copy/paste (which is what I'm currently doing).

GeekTrainer avatar Nov 30 '20 18:11 GeekTrainer

It's perplexing to me that this was designed the way it was. The local.settings.json file contains information that is crucial for debugging, particularly these:

    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
    }

Without this file in place, if you try to debug the Functions project locally, it just fails miserably. Yet, even though the file is basically required for running the project, it is by design excluded from source control with the includion of a dedicated .gitignore.

How are you folks sharing Function project code across multiple folks/teams? It just doesn't make sense to have people keeping random copies of local files and sending those from developer to developer to be able to debug a project after cloning the repository. It is crazy to me that this approach was deemed acceptable.

It's been over 2 years since this issue was created, and even it is basically a nasty workaround to the underlying problem, yet it hasn't been implemented.

Would be nice if the team could share their vision for how they intend to manage this going forward. Will we have to wait until .NET8 for another shot at changing this approach, or is there something in the pipeline to avoid the problem altogether?

julealgon avatar Nov 25 '22 21:11 julealgon

As a temporary solution, I just want to commit a template file. What could be the best name for it?

  • local.settings.json.template
  • local.settings.template.json
  • something else?

webmaxru avatar Jun 15 '23 22:06 webmaxru

Would be nice if the team could share their vision for how they intend to manage this going forward. Will we have to wait until .NET8 for another shot at changing this approach, or is there something in the pipeline to avoid the problem altogether?

Apparently we have to wait even longer than .NET 8

pihai avatar Feb 07 '24 06:02 pihai

@anthonychu can you provide some updaters on this to the community? What would be needed for this to be prioritized higher?

julealgon avatar Feb 07 '24 12:02 julealgon