ballerina

Providing additional Config files using VS Code


How can we use multiple .toml files as specified in https://github.com/ballerina-platform/ballerina-spec/blob/master/configurable/spec.md#locating-toml-files using Visual Studio Code? (Assuming that I want to use Config.toml and B.toml) In .vscode/launch.json I added:

{
"version": "0.2.0",
    "configurations": [
        {
            "name": "Ballerina Run",
            "type": "ballerina",
            "request": "launch",
            "programArgs": [],
            "commandOptions": [],
            "env": {
                "BAL_CONFIG_FILES": "./Config.toml:./B.toml"
            }
        }
    ]
}

I am not able to provide configurable variables through B.toml, only the variables added via the Config.toml are being picked up.
It is working when providing config files through command line as follows:
In Linux BAL_CONFIG_FILES="./Config.toml:./B.toml" bal run.
But it does not work by adding the config files to .vscode/launch.json and run the program by pressing the Run button.


Solution

  • In VS Code, internally the Run button will only open a new terminal and run the bal run command. The config you added in the .vscode/launch.json are not used there.