{"id":20743492,"url":"https://github.com/andr83/scalaconfig","last_synced_at":"2026-02-27T21:02:45.495Z","repository":{"id":86492906,"uuid":"65745074","full_name":"andr83/scalaconfig","owner":"andr83","description":"Scala way to work with Typesafe Config","archived":false,"fork":false,"pushed_at":"2020-08-05T07:34:46.000Z","size":46,"stargazers_count":28,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T07:22:25.779Z","etag":null,"topics":["config","scala","typesafe-config"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andr83.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-15T15:58:19.000Z","updated_at":"2022-11-28T14:09:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"061c5dae-830d-44e5-9aea-1d286ecc6c20","html_url":"https://github.com/andr83/scalaconfig","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andr83%2Fscalaconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andr83%2Fscalaconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andr83%2Fscalaconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andr83%2Fscalaconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andr83","download_url":"https://codeload.github.com/andr83/scalaconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250572638,"owners_count":21452334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","scala","typesafe-config"],"created_at":"2024-11-17T07:11:10.151Z","updated_at":"2026-02-27T21:02:40.460Z","avatar_url":"https://github.com/andr83.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scalaconfig\n\n[![Build Status](https://travis-ci.org/andr83/scalaconfig.svg?branch=master)](https://travis-ci.org/andr83/scalaconfig)\n[![codecov](https://codecov.io/gh/andr83/scalaconfig/branch/master/graph/badge.svg)](https://codecov.io/gh/andr83/scalaconfig)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.andr83/scalaconfig_2.11/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.andr83/scalaconfig_2.11)\n\nScalaConfig is a lightweight wrapper over ~~Typesafe~~ Lightbend Config library provides scala friendly access. \nIt is implemented with type classes pattern and use shapeless for reading case classes.\n\n\u003e Current documentation is a actual for 0.7 version.\n\nScalaConfig adds additional metods:\n\n* `as[A](path)` - return `Either[Seq[Throwable], A]` by path in config object\n* `as[A]` - convert config object to `Either[Seq[Throwable], A]`\n* `asUnsafe[A](path)` - return value of type `A` by path in config object. On fail a first exception will thrown.\n* `asUnsafe[A]` - convert config object to value of type `A`. On fail a first exception will thrown.\n\n## Supported types\n\n* Primitive (`Int`, `Long`, `Float`, `Double`, `Boolean`)\n* `String`, `Symbol`\n* Typesafe `Config` and `ConfigValue`\n* `FiniteDuration`\n* `Properties`\n* Collections (`List[A]`, `Set[A]`, `Map[String, A]`, `Map[String, AnyRef]`, `Array[A]`, etc. All types with a CanBuildFrom instance are supported)\n* `Option[A]`\n* Case classes\n\n## Examples\n\n```scala\nimport com.github.andr83.scalaconfig._\n\nval config: Config = ConfigFactory.load()\n\nval host   = config.asUnsafe[String](\"host\")\nval port   = config.asUnsafe[Int](\"port\")\nval path   = config.asUnsafe[Option[String]](\"path\")\nval users  = config.asUnsafe[List[String]](\"access.users\")\n\ncase class DbConfig(host: String, port: Int, user: Option[String] = None, passwd: Option[String] = None)\n\nval dbConfig: Reader.Result[DbConfig]               = config.as[DbConfig](\"db\")\nval dbConfig2: Reader.Result[DbConfig]              = config.as[DbConfig] // Direct `config` mapping to case class\nval dbConfig3: Reader.Result[Map[String, String]]   = config.as[Map[String, String]]\nval dbConfig3: Reader.Result[Map[String, AnyRef]]]  = config.as[Map[String, AnyRef]]\n\n// Custom reader \nclass User(name: String, password: String)\n\nimplicit def userReader: Reader[User] = Reader.pure((config: Config, path: String) =\u003e {\n    val userConfig = config.getConfig(path)\n    new User(\n      user = userConfig.asUnsafe[String](\"name\"),\n      password = userConfig.asUnsafe[String](\"password\")\n    )\n  }\n})\n\n// OR\nimplicit def userReader: Reader[User] = Reader.pureV((config: Config, path: String) =\u003e {\n    val userConfig = config.getConfig(path)\n    \n    val userE = userConfig.as[String](\"name\")\n    val passwordE = userConfig.as[String](\"password\")\n    \n    // with Cats or Scalaz it can be of course more elegant!\n    (userE, passwordE)  match {\n      case (Right(user), Right(password)) =\u003e Right(new User(user, password))\n      case ( Left(errors1), Left(errors2)) =\u003e Left(errors1 ++ errors2)\n      case (Left(errors), _) =\u003e Left(errors)\n      case (_, Left(errors)) =\u003e Left(errors)\n    }\n  }\n})\n\n```\n\n## Implementation details\nhttps://andr83.io/en/1384/\n\n## Usage\n\n### Latest release.\n\n```scala\n// for \u003e= Scala 2.11.x, 2.12.x, 2.13.x\nlibraryDependencies += \"com.github.andr83\" %% \"scalaconfig\" % \"0.7\"\n```\n\nIf you want scala 2.10 support please use 0.4 version. \n\n### Develop branch.\n\n```scala\nresolvers += Resolver.sonatypeRepo(\"snapshots\")\n\nlibraryDependencies += \"com.github.andr83\" %% \"scalaconfig\" % \"0.8-SNAPSHOT\"\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2016 Andrei Tupitcyn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandr83%2Fscalaconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandr83%2Fscalaconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandr83%2Fscalaconfig/lists"}