Skip to content

Add environment variables for Launcher path and args in ANCM #19797

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

Merged
merged 2 commits into from
Mar 13, 2020

Conversation

BrennanConroy
Copy link
Member

Fixes #19451

{
var deploymentParameters = Fixture.GetBaseDeploymentParameters(hostingModel);

deploymentParameters.EnvironmentVariables["ANCM_LAUNCHER_PATH"] = "nope";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotalik I'm hoping you might have some ideas of how to write some positive tests instead of just negative 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could copy the app to a different temporary folder and set ANCM_LAUNCHER_PATH/LAUNCHER_ARGS to that folder?

Copy link
Member Author

@BrennanConroy BrennanConroy Mar 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to copy anything, but how do I know where the app is located? Ah, you can do a publish to get the folder of an app and then set the variables to that folder and then run deploy. And is launcher path always just dotnet.exe? Because I have _dotnetLocation available.

@analogrelay
Copy link
Contributor

@BrennanConroy if you can provide either an MSI or just a share with the changed DLLs to @BillHiebert, I expect he can start looking at the matching VS changes.

@BrennanConroy
Copy link
Member Author

I'm assuming he'll want both changes in the DLLs?

@@ -101,6 +102,8 @@ REQUESTHANDLER_CONFIG::Populate(
BSTR bstrBasicAuthSection = NULL;
BSTR bstrAnonymousAuthSection = NULL;
BSTR bstrAspNetCoreSection = NULL;
auto launcherPathEnv = Environment::GetEnvironmentVariableValue(CS_ANCM_LAUNCHER_PATH);
auto launcherArgsEnv = Environment::GetEnvironmentVariableValue(CS_ANCM_LAUNCHER_ARGS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to be careful about calling GetEnvironmentVariableValue in the out of proc code. For example, if GetEnvironmentVariableValue fails, it throws an exception. I'd recommend try/catching around these call or checking where the next try catch is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@analogrelay
Copy link
Contributor

I'm assuming he'll want both changes in the DLLs?

Yep. I was thinking that because the other change had merged it would be relatively straightforward to get both changes into a build now. If this PR moves quickly enough we can wait for it to merge, I just don't want us to wait too long here :).

@BrennanConroy BrennanConroy merged commit 25b4f80 into master Mar 13, 2020
@BrennanConroy BrennanConroy deleted the brecon/launcher branch March 13, 2020 23:07
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ANCM to use environment variables for LAUNCHER_ARGS and LAUNCHER_PATH
4 participants