Skip to content

Simple Scala library to parse configuration from environmental variables

License

Notifications You must be signed in to change notification settings

foxmk/scala-envconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-envconfig

Build status Apache 2.0 licensed

scala-envconfig is a simple Scala library for parsing configuration from environmental variables inspired by kelseyhightower/envconfig and joeshaw/envdecode libraries for Go.

Usage

import com.github.foxmk.envconfig._

@envprefix("FEATURE_")
case class Config(
  @env("NAME") name: String,
  @env("ENABLED", default = Some("true")) enabled: Boolean
)

Set up your enviroment:

export FEATURE_NAME=foo
export FEATURE_ENABLED=false

and parse the configuration:

import com.github.foxmk.envconfig._

val config = ConfigParser.parse[Config](sys.env) 

Known limitations

  • Config class should be top-level declaration
  • Parameters in env annotation should go in defined order (name and then default)

About

Simple Scala library to parse configuration from environmental variables

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages