-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support passing environment variables to dapr cli #327
Conversation
afe4a42
to
0812e40
Compare
@microsoft-github-policy-service agree |
0812e40
to
8a5df4d
Compare
@philliphoff is it possible to get a review for this PR. |
@evhen14 Much of the task implementation is from the early days of VS Code's custom task support, before there was better integration with the shell/terminal. What would you consider to be the "standard" way. |
@@ -86,7 +86,7 @@ export default class DaprCommandTaskProvider extends CommandTaskProvider { | |||
await checkFileExists(runFilePath).then((fileExists) => { | |||
if (fileExists) { | |||
const command = createCommandLineBuilder(daprPathProvider, { type: 'dapr', runFile: runFilePath }).build(); | |||
return callback(command, { cwd: definition.cwd }); | |||
return callback(command, { cwd: definition.cwd, env: Object.assign({}, definition.options?.env, process.env) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, it'd be great to support this in the daprdCommandTaskProvider
and daprdDownTaskProvider
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add env
for the daprd command. The daprdDownTaskProvider
doesn't need env variables as it only sends SIGKILL
to the existing process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough.
I'm new to VS Code extensions and it seems like https://code.visualstudio.com/api/references/vscode-api#ProcessExecution does take into account the |
@yevgen-el8 It looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. I think the only thing left is to flesh out the task definitions for both dapr
and daprd
tasks (e.g. to include the env
property on the option
property).
I'm not sure what you mean there. The task definition already has |
@yevgen-el8 Sorry, I meant the task JSON schema definition in the |
@philliphoff Thank you. Please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for the contribution!
Resolving issue #326
There is a "standard" way for running processes. However, the original implementation is not using it. Lacking understanding why it was done this way, I only extended the current implementation.