Recommand · June 21, 2021 0

Dynamic uriFormat setup in launch.json

I’d like to assembly the uriFormat, depending on one setting in my appsettings.local.json
something like


then read the configuration and apply that prefix to the uriFormat

"serverReadyAction": {
    "action": "openExternally",
    "pattern": "\\bNow listening on:\\s+(https?://\\S+)",
    "uriFormat": "%s/api/swagger" <--api as parameter

I’ve been reading documentation to add variables from the environment variables, so seems like I’d have to leverage three different parts to accomplish this

  • Set the property in appseetings.json
  • Read and parse that file from task.json, maybe using the command line
  • Set the environment variable with the info obtained in the previous step

is there a better way to do it?