ikamman / sbt-env

SBT plugin for loading *.env file variables into SBT global settings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sbt-env

Build Status Download License

SBT plugin for loading *.env file variables into SBT global settings

Installation

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

    resolvers += Resolver.bintrayRepo("nietsnie", "sbt-plugins")

    addSbtPlugin("com.github.ikamman" %% "sbt-env" % "0.9.x")

After this step you will find all variables in the Global scope:

    envVariables in Global

Usage

Just create your .env file near your build.sbt:

    vi .env

add your variables:

    APPLICATION_VERSION=0.0.1-SNAPSHOT 
    # or
    export SERVER_PORT=25
    # or
    URL_PATH="https://github.com/ikamman/sbt-env"

.env file name change

Here you can change the file name .env

    envFileName in Global := "versions.env"

Use definied variables to change anything in your sbt file

Due to fact that environment variables are stored in Setting[Map[String, String]] you can change anything in your sbt configuration:

    version := envVariables.value("APPLICATION_VERSION")

A note about requirements

This plugin needs SBT 1.x+ version to work properly.

Credits and inspiration

Big thanks to Matt Fellows and his sbt-dotenv amazing sbt plugin. It was the main inspiration to create this plugin.

Example

This repo is itself an example ;)

About

SBT plugin for loading *.env file variables into SBT global settings

License:MIT License


Languages

Language:Scala 100.0%