Skip to content
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

Environment variables in Rider is not picked up by get_env #307

Open
Baune8D opened this issue Dec 6, 2024 · 10 comments
Open

Environment variables in Rider is not picked up by get_env #307

Baune8D opened this issue Dec 6, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@Baune8D
Copy link

Baune8D commented Dec 6, 2024

Bug Description

Environment variables from Rider run configuration does not seem to be propagated to mirrord template engine.

Steps to Reproduce

image image image

Backtrace

No response

Relevant Logs

No response

Your operating system and version

macOS 15.1.1

Local process

dotnet

Local process version

8.0.11

Additional Info

No response

@Baune8D Baune8D added the bug Something isn't working label Dec 6, 2024
Copy link

linear bot commented Dec 6, 2024

Copy link
Member

aviramha commented Dec 6, 2024

Thanks for reporting this. Can you please share mirrord Plugin version and Rider version?

@Baune8D
Copy link
Author

Baune8D commented Dec 17, 2024

Using Rider 2024.3.2 and plugin version 3.64.2

@aviramha
Copy link
Member

@Baune8D how did you add the env variable? using launchSettings.json?

@Baune8D
Copy link
Author

Baune8D commented Dec 17, 2024

@Baune8D how did you add the env variable? using launchSettings.json?

Yes.

Copy link
Member

Thanks. I managed to reproduce on macOS

@aviramha
Copy link
Member

Looks like the environment variables aren't seen in our entrypoint - I think this is an issue on IntelliJ side since it does show for Linux setup. Need to do bit more of investigation from our side and then open issue on JetBrains' tracker

@meowjesty
Copy link
Member

I've tested it on a somewhat outdated Rider:

Image

Image

Image

Image

And it seems to be working on Linux, I'll update rider and try again.

Image

When I had just DEPLOYMENT_NAME=sample-python-deployment, without the deploy/ before it, mirrord verify config was correctly identifying it as an invalid target, confirming that we are getting the env var.

@aviramha
Copy link
Member

It's on a specific run configuration, one that doesn't allow you to set environment variables directly in the IDE but using the launchSettings.json @Razz4780 maybe you have screenshot?

@meowjesty
Copy link
Member

meowjesty commented Jan 17, 2025

Alright, I've also tried it with a launchSettings.json, setting DEPLOYMENT_NAME only there, and not in the rider Edit run configuration. The right target env variable is being sent as expected to mirrord (everything works).

I can see that after modifying my launchSettings.json, the rider Run configuration - Environment variables has also been modified, even though I had not touched it. From the rider docs, it looks like rider is refreshing its config based on things you put in the launchSettings.json file.

Maybe in the failure case a "turn it off and turn it back on" was required to refresh this config? I'm not even sure if that's needed, since rider says: Profile parameters are set by Properties/launchSettings.json.

  • launchSettings.json:
{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "profiles": {
    "http": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "applicationUrl": "http://localhost:5193",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "DEPLOYMENT_NAME": "deploy/sample-python-deployment"
      }
    },
    "https": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "applicationUrl": "https://localhost:7065;http://localhost:5193",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "DEPLOYMENT_NAME": "deploy/sample-python-deployment"
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants