mefellows / sbt-dotenv

Simple Dotenv implementation for Scala SBT Builds. Configures environment for local development.



Build Status Current Version License

sbt plugin to load environment variables from .env into the JVM System Environment for local development.


But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. sbt-dotenv loads variables from a .env file into ENV when the environment is bootstrapped.

sbt-dotenv is intended to be used in development.


Add the following to your sbt project/plugins.sbt file:

addSbtPlugin("" %% "sbt-dotenv" % "1.2.88")

That's it - as soon as you start using sbt the environment is prepared.


Create a .env file in the root of your project with some environment specific settings. For example, you might want to set a Mongo DB port to 17017 if it's installed by Homebrew.

vi .env


Should I commit my .env file?

It is recommended that you store development-only settings in your .env file, and commit it to your repository. Make sure that all your credentials for your development environment are different from your other deployments. This makes it easy for other developers to get started on your project, without compromising your credentials for other environments.

sbt version

Please note that this plugin takes advantage of sbt Auto Plugins and therefore only works in sbt v0.13.5+


  1. Fork it
  3. Commit your changes (git commit -am 'Added some feature') and, optionally, squash history (git rebase -i <previous commit hash>)
  5. Create new Pull Request