FoxxMD / EnvFile

EnvFile 2.0 is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EnvFile

Description

Env File is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.

Version 2.0 Notice

Please notice that EnvFile just received a major upgrade and was released as a new major version - v2.0. With the main goal of major update being support for more JetBrains platforms a lot of things changed, including UI, so please be sure to read the updated guide below, even if you already have used previous versions of EnvFile.

Supported Formats

All formats assume that both keys and values are strings.

Supported Platforms

Expand to see supported run configuration types. Italic means that run configuration is only available in paid version of the product.

PyCharm
  • App Engine server
  • Behave
  • Django server
  • Django tests
  • Lettuce
  • Pyramid server
  • Python
  • Python docs
    • Docutils task
    • Sphinx task
  • Python test
    • Unittests
    • Doctests
    • Nosetests
    • py.test
    • Attests
  • Tox
IDEA
  • Application
  • Arquillian JUnit
  • Arquillian TestNG
  • CloudBees Server
  • Cucumber Java
  • GWT Configuration
  • Geronimo Server
    • Local
    • Remote
  • GlassFish Server
    • Local
    • Remote
  • Google AppEngine Dev Server
  • Grails
  • JAR Application
  • JBoss Server
    • Local
    • Remote
  • JSR45 Compatible Server
    • Local
    • Remote
  • Jetty Server
    • Local
    • Remote
  • JUnit
  • Kotlin
  • Kotlin script
  • Resin
    • Local
    • Remote
  • Spring Boot
  • Spring dmServer
    • Spring dmServer (Local)
    • Spring dmServer (Remote)
  • TestNG
  • TomEE Server
    • Local
    • Remote
  • TomCat Server
    • Local
    • Remote
  • WebLogic Server
    • Local
    • Remote
  • WebSphere Server
    • Local
    • Remote
RubyMine
  • Capistrano
  • Cucumber
  • Gem Command
  • IRB Console
  • RSpec
  • Rack
  • Rails
  • Rake
  • Ruby
  • Spork DRb
  • Test::Unit/Shoulda/Minitest
  • Zeus Server

Installation

  • Using IDE built-in plugin system:

    • Preferences > Plugins > Browse repositories... > Search for "Env File" > Install Plugin
  • Manually:

    • Download the latest release and install it manually using Preferences > Plugins > Install plugin from disk...

Restart IDE.

Usage

  • Add new Run/Debug configuration: + Add new configuration > ...
  • Switch to EnvFile tab
  • Enable EnvFile checkbox
  • Click on + to add a file

Read from file

Examples

.env

# This line is ignored since it's a comment
SECRET_KEY=hip-hip-env-files
VERSION=1.0

or

# This line is ignored since it's a comment
SECRET_KEY hip-hip-env-files
VERSION 1.0

JSON

{
    # JSON doesn't have comments but since JSON is subset of YAML
    # We parse it with YAML parser and therefore have comments
    # And even trialling commas in objects :)
    "SECRET_KEY": "hip-hip-env-files",
    "VERSION": "1.0", # All non-string literals should be enclosed in quotes; btw this is ignored too
}

YAML

# This line is ignored since it's a comment
SECRET_KEY: hip-hip-env-files
VERSION: "1.0" # All non-string literals should be enclosed in quotes; btw this is ignored too 

Bash (workaround)

There was a number of requests to support extracting environment variables from bash scripts like:

export SECRET_KEY="hip-hip-env-files"
export VERSION="1.0"

The feasible way to do that is yet to be discovered (if any at all) so the plugin does not support that at the moment. On the other hand there is a simple workaround that can be used for the time being. The example bash script from above can be split into an .env file and a generic script that can be used to set environment variables on a command line:

.env

SECRET_KEY="hip-hip-env-files"
VERSION="1.0"

set-env.sh

while read -r line; do export $line; done < .env

usage

$ . set-env.sh
$ echo $VERSION
1.0

Further Development

  • Add more formats (upon requests)
  • Add support for other JetBrains products/plugins (upon requests)
  • Add environment variables expansion (feasible?)
  • Add unit tests (¯_(ツ)_/¯)

Feedback

Any feedback, bug reports and feature requests are highly appreciated!

Feel free to create an issue, contact me using Github or just drop me an email to the address specified in plugin.xml/idea-plugin/vendor@email.

License

Copyright (c) 2017 Borys Pierov. See the LICENSE file for license rights and limitations (MIT).

About

EnvFile 2.0 is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.

License:MIT License


Languages

Language:Java 100.0%