{"id":13565789,"url":"https://github.com/cbeust/konfig","last_synced_at":"2026-02-14T02:15:19.133Z","repository":{"id":136982563,"uuid":"124173454","full_name":"cbeust/konfig","owner":"cbeust","description":"A statically typed configuration library for Kotlin","archived":false,"fork":false,"pushed_at":"2018-03-07T05:59:45.000Z","size":65,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-04T19:42:11.299Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbeust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-07T03:27:57.000Z","updated_at":"2024-04-06T17:47:14.000Z","dependencies_parsed_at":"2023-03-22T12:17:27.439Z","dependency_job_id":null,"html_url":"https://github.com/cbeust/konfig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbeust%2Fkonfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbeust%2Fkonfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbeust%2Fkonfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbeust%2Fkonfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbeust","download_url":"https://codeload.github.com/cbeust/konfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247097584,"owners_count":20883121,"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-08-01T13:01:55.509Z","updated_at":"2026-02-14T02:15:19.099Z","avatar_url":"https://github.com/cbeust.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Konfig\nStatically typed configuration for Kotlin\n\n## What is Konfig?\n\nKonfig allows you to express your configuration files in Kotlin so that the objects created after\nparsing your configuration are the exact objects that your code expects. This guarantees that\nyour code and its configuration files will never go out of sync and they will be verified by\nthe Kotlin compiler.\n\n## How does it work?\n\nAssume your configuration classes are as follows:\n\n```kotlin\nenum class Db { POSTGRES, MYSQL }\ndata data class Config(var name: String = \"\", val db: Db = Db.MYSQL)\n```\n\nYour configuration file will be the following valid Kotlin, saved in a Kotlin Script file, e.g. `config.kts`:\n\n```kotlin\nConfig(\n    name = \"John\",\n    db = Db.POSTGRES\n)\n```\n\nYou can parse this file with the following code:\n\n```kotlin\nval config = Konfig().parse\u003cConfig\u003e(FileReader(\"test.kts\"))\nassertThat(config).isEqualTo(Config(\"John\", Db.POSTGRES))\n```\n\n## Pros and cons\n\nThe immediate benefit is that your configuration syntax can evolve without any risk of ever breaking, as can often\nhappen when you use some other external format (XML, JSON, .properties, etc...).\n\nAnother advantage is that since your configuration file is pure Kotlin, you can use any piece of Kotlin code\ninside that you need, e.g. retrieving environment variables, etc...\n\nThere is a sizeable disadvantage to this approach: the Kotlin Script parser is very slow. Admittedly, it's still\nexperimental and being actively worked on, but on my laptop, parsing even a trivial configuration takes between\nfive and six seconds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbeust%2Fkonfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbeust%2Fkonfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbeust%2Fkonfig/lists"}