1

I deploy my NodeJS web app through VS Code to my azure web app. That works fine, but it also takes the .env file, which is for local purposes only. I tried excluding it in .vscode\settings.json by adding it to appService.zipIgnorePattern like

{
    "appService.zipIgnorePattern": [
        "node_modules{,/**}",
        ".vscode{,/**}",
        ".env"
    ]
}

enter image description here

But it is still visible after redeploy in the files section of my VS code azure plugin.

Update: I figured the file is indeed excluded, but the one from the original deployment is still there. Is there an option to remove files from previous deployments? This is a Linux hosted NodeJS Web App.

kcode
  • 1,220
  • 1
  • 18
  • 34

1 Answers1

1

Try mentioning like this,

"appService.zipIgnorePattern": [
    "node_modules{,/**}",
    ".vscode{,/**}",
    ".env{,/**}"
 ]
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • I tried that (just did a deploy with this setting), but the file remains in the list after refresh (I added a screenshot to the original question) – kcode Jan 02 '21 at 18:33
  • I figured already the initial exclusion worked, but the issue is, that the original file is still present. Is there a way to remove "old" files on every deployment? I have not found a setting for that. – kcode Jan 02 '21 at 19:19
  • if you are using azure devops, you can do it via https://stackoverflow.com/questions/46801799/how-to-clean-up-wwwroot-folder-on-the-target-azure-websites-windows-server-befor – Sajeetharan Jan 03 '21 at 03:39
  • I'm using VS Code to deploy and the target is Linux, so this is unfortunately not applicable to my context. – kcode Jan 03 '21 at 11:03
  • That does not matter – Sajeetharan Jan 03 '21 at 12:19
  • How could I set that parameter? There is no such option in the deploy process in VS code. I have not found any setting to set that. – kcode Jan 03 '21 at 16:13