Skip to content

Commit

Permalink
Changes that will allow an array of envFile locations to be defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Hillmann committed Aug 22, 2024
1 parent 4a903c4 commit f6df9ee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ In case you want to manually edit the configuration, below are the explanation a
}
```

- `envFile` - Absolute path to a file containing environment variable definitions.
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by provided an array of absolute paths
```json
{
"version": "0.2.0",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
- `projectName` - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. This setting also works when the debugger looks for the specified main class when launching a program. It is required when the workspace has multiple java projects, otherwise the expression evaluation and conditional breakpoint may not work.
- `cwd` - The working directory of the program. Defaults to `${workspaceFolder}`.
- `env` - The extra environment variables for the program.
- `envFile` - Absolute path to a file containing environment variable definitions.
- `envFile` - Absolute path to a file containing environment variable definitions. Multiple files can be specified by provided an array of absolute paths
- `stopOnEntry` - Automatically pause the program after launching.
- `console` - The specified console to launch the program. If not specified, use the console specified by the `java.debug.settings.console` user setting.
- `internalConsole` - VS Code debug console (input stream not supported).
Expand Down
18 changes: 14 additions & 4 deletions src/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,20 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
let result = baseEnv;
if (config.envFile) {
try {
result = {
...baseEnv,
...readEnvFile(config.envFile),
};
if (typeof config.envFile === 'string') {
result = {
...result,
...readEnvFile(config.envFile)
};
}
if (Array.isArray(config.envFile)) {
config.envFile.forEach((f) => {
result = {
...result,
...readEnvFile(f)
};
});
}
} catch (e) {
throw new utility.UserError({
message: "Cannot load environment file.",
Expand Down

0 comments on commit f6df9ee

Please sign in to comment.