{"id":15494271,"url":"https://github.com/andyglow/typesafe-config-scala","last_synced_at":"2025-04-22T20:23:14.335Z","repository":{"id":10698681,"uuid":"61786564","full_name":"andyglow/typesafe-config-scala","owner":"andyglow","description":"Little scala extension to Typesafe Config","archived":false,"fork":false,"pushed_at":"2025-03-17T14:08:14.000Z","size":210,"stargazers_count":9,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T18:36:29.214Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andyglow.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-06-23T08:02:08.000Z","updated_at":"2025-03-17T14:08:18.000Z","dependencies_parsed_at":"2023-02-19T08:16:13.514Z","dependency_job_id":"9de285b9-4588-47a2-9d55-942c93ca4978","html_url":"https://github.com/andyglow/typesafe-config-scala","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Ftypesafe-config-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Ftypesafe-config-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Ftypesafe-config-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyglow%2Ftypesafe-config-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyglow","download_url":"https://codeload.github.com/andyglow/typesafe-config-scala/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250316564,"owners_count":21410564,"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":[],"created_at":"2024-10-02T08:12:57.537Z","updated_at":"2025-04-22T20:23:14.316Z","avatar_url":"https://github.com/andyglow.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typesafe Config (little scala wrapper)\n\n[![Build Status](https://github.com/andyglow/typesafe-config-scala/actions/workflows/ci.yml/badge.svg)]()\n[![codecov](https://codecov.io/gh/andyglow/typesafe-config-scala/branch/master/graph/badge.svg?token=iqtc5BQRAp)](https://codecov.io/gh/andyglow/typesafe-config-scala)\n[![mvn](https://img.shields.io/badge/dynamic/json.svg?label=mvn\u0026query=%24.response.docs%5B0%5D.latestVersion\u0026url=https%3A%2F%2Fsearch.maven.org%2Fsolrsearch%2Fselect%3Fq%3Dtypesafe-config-scala_2.13%26start%3D0%26rows%3D1)](https://search.maven.org/artifact/com.github.andyglow/typesafe-config-scala_2.13/)\n\nLittle scala extension to Typesafe Config\n\n## Usage\n\n### build.sbt\n```\nlibraryDependencies += \"com.github.andyglow\" %% \"typesafe-config-scala\" % ${LATEST_VERSION} % Compile\n```\n\n### Code\nImport it\n```scala\nimport com.github.andyglow.config._\n```\n\nAnd then you will be able to\n#### Get value by specifying needed type\n```scala\nval v1 = config.get[String](\"path\")\nval v2 = config.get[Int](\"path\")\nval v3 = config.get[FiniteDuration](\"path\")\n\n```\n#### Get rid of `if hasPath this else that` by leveraging notion of options\n```scala\n// optional value\nval val1: Option[String] = config.get[Option[String]](\"path\")\nval val2: String         = config.getOrElse[String](\"path\", \"default\")\n```\n\n#### Have more flexible api for working with multi-values\n```scala\nval list1     = config.get[List[String]](\"path\")\nval set2      = config.get[Set[Int]](\"path\")\nval iterator3 = config.get[Iterator[ConfigMemorySize]](\"path\")\n```\n\n### Supported types\n- `String`\n- `Int`\n- `Boolean`\n- `Double`\n- `Long`\n- `Bytes` (file size, etc...)\n- `Duration` (java.time)\n- `Duration` (scala)\n- `FiniteDuration`\n- `ConfigList`\n- `Config`\n- `ConfigObject`\n- `ConfigMemorySize`\n- `Date` (java.util)\n- `Date` (java.sql)\n- `Time` (java.sql)\n- `Timestamp` (java.sql)\n- `LocalDate` (java.time)\n- `LocalTime` (java.time)\n- `LocalDateTime` (java.time)\n- `OffsetDateTime` (java.time)\n- `ZonedDateTime` (java.time)\n- `DayOfWeek` (java.time)\n- `Month` (java.time)\n- `Year` (java.time)\n- `Option[T]` where `T` is one of the supported types\n- scala collections. `Seq[T]`, etc. \n  Any sort of collection types which has corresponding `CanBuildFrom`\n\n### Extending\nAlso this can be extended by providing implementations for `FromConf` and/or `ConfType` \n(used for collections and might be implicitly reused for `FromConf`)\nFor example take a look at `com.github.andyglow.config.ConfType#juDateT` implementation \nand spec at `com.github.andyglow.config.JavaUtilDateExtSpec`\n\n### Flatten\nOften we need to transform configs into some more trivial structures like Maps or java Properties.\nFor these sort or problems we provide `Flatten` function.\nIt map take `Config` or `ConfigValue` and produce either Properties or Map.\nExample:\n```scala\nval conf: Config = ???\n\n// for config\nval properties = Flatten[java.util.Properties](conf)\nval stringMap = Flatten[Map[String, String]](conf)\n\n// for value\nval properties = Flatten[java.util.Properties](conf.getValue(\"some-prop\"))\nval stringMap = Flatten[Map[String, String]](conf.getValue(\"some-prop\"))\n\n// also you can flatten config into already initialized instance of either Properties of Map\nval propertiesWithConfig = Flatten(conf.getValue(\"some-prop\"), properties)\nval stringMapWithConfig = Flatten(conf.getValue(\"some-prop\"), stringMap)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyglow%2Ftypesafe-config-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyglow%2Ftypesafe-config-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyglow%2Ftypesafe-config-scala/lists"}