ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
552 stars 128 forks source link

Support JetBrains HTTP client env file format #123

Open medmunds opened 4 years ago

medmunds commented 4 years ago

Feature request: support using JetBrains HTTP client environment files as EnvFile sources. This would allow sharing the same env between the IDE's bundled HTTP client and run configurations.

JetBrains HTTP client env files are JSON, but they contain multiple named environments, each with its own set of environment variables. Example:

{
  "development": {
    "API_KEY": "dev-key",
    "DB_HOST": "localhost:3136"
  },
  "production": {
    "API_KEY": "prod-key",
    "DB_HOST": "db1.example.com"
  }
}

It might be possible to detect this format automatically: right now trying to use it with EnvFile results in the error class java.util.LinkedHashMap cannot be cast to class java.lang.String.

But there would also need to be something in the EnvFile panel to choose which environment to load ("development" vs "production" in the example above).

[Thanks for this amazingly helpful plugin, btw.]

ashald commented 3 years ago

Sound like a great idea! I have very limited time available for maintaining this plugin so cannot promise I'll be able to get to it any time soon, but would welcome a PR!