{"id":15470828,"url":"https://github.com/mpope9/config","last_synced_at":"2026-01-20T14:33:39.592Z","repository":{"id":108759043,"uuid":"259164886","full_name":"mpope9/config","owner":"mpope9","description":"Gleam + TOML =  ❤️","archived":false,"fork":false,"pushed_at":"2020-05-01T02:29:17.000Z","size":22,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T18:22:24.267Z","etag":null,"topics":["erlang","gleam","toml","toml-config"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpope9.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":"2020-04-27T00:36:50.000Z","updated_at":"2022-04-24T17:22:19.000Z","dependencies_parsed_at":"2023-03-23T08:34:43.670Z","dependency_job_id":null,"html_url":"https://github.com/mpope9/config","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"e0e52befc41fbe35e7d67ca0251279aa48a82bda"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mpope9/config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpope9%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpope9%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpope9%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpope9%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpope9","download_url":"https://codeload.github.com/mpope9/config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpope9%2Fconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28604939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T12:01:53.233Z","status":"ssl_error","status_checked_at":"2026-01-20T12:01:46.545Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["erlang","gleam","toml","toml-config"],"created_at":"2024-10-02T02:07:02.867Z","updated_at":"2026-01-20T14:33:39.568Z","avatar_url":"https://github.com/mpope9.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# config\n\n![test](https://github.com/mpope9/config/workflows/test/badge.svg)\n\n## TOC\n* [Installation](#installation)\n* [Example Usage](#example-usage)\n* [Updating Values](#updating-values)\n* [Get Entire Config](#get-entire-config)\n* [Keys](#keys)\n* [Set Configuration File](#set-configuration-file)\n\nA Gleam configuration library.\n\nRelys on erlang's [persistent_terms](https://erlang.org/doc/man/persistent_term.html).\n\n## Installation\n\n```erlang\n{deps, [\n    {config, {git, \"https://github.com/mpope9/config\"}}\n]}.\n```\n\n## Example Usage\nThis is powered by a gen_server, but configs are parsed and stored independently.  The gen_server is for safety and to optimize puts.\n\nConfiguration:\n```toml\n[test1.test2]\ntest3 = true\n```\n\nUsage:\n```gleam\nimport gleam/config\nimport gleam/dynamic\n\nconfig.new()                    // Parses the config and stores it.\nconfig.start()                  // Starts the config server.\nconfig.get(\"test1.test2.test3\") // Access.\n|\u003e expect.equal(_, Ok(True))\n\nconfig.get_default(\"not.existing\", False)\n|\u003e expect.equal(_, Ok(False))\n```\n\n## Updating Values\nUpdates to the config can have a performance penalty, due to `persistent_term`s being optimized for reads over writes.  So it is preffered to update configs in batches.  This is done through passing a map to the config module.  Values in the map will override existing configuration values.\n\n```gleam\nimport gleam/map\n\nlet new_config = \n   map.new\n   |\u003e map.insert(_, \"key1\", \"value1\")\n   |\u003e map.insert(_, \"Ricky Booby\", \"Cal Naughton Jr.\")\n\nconfig.put_batch(new_config)\n```\n\nTo update a single value, the following api is provided, although its use is discouraged if multiple updates need to be made.  It will also override an existing value.\n```gleam\nconfig.put(\"key1\", \"value1\")\n```\n\n## Get Entire Config\nGetting the whole configuration is supported.\n```gleam\nconfig.get_config()\n```\n\n## Keys\nParses toml files and stores them as strings.  At this time, only string key are supported.\nAn example:\n\n```toml\n[test1.test2]\ntest3 = true\n```\n\nThis config's key is transalted to the Gleam string:\n```gleam\n\"test1.test2.test3\"\n```\nand returns an atom value when accessed.\n\n## Set Configuration File\nThe default config value lives at `config/config.toml` for a project.\nTo use a seperate config file, you can set the environment variable `GLEAM_CONFIG`.\n\n### TODO\n1. Ability to add to the Gleam supervision tree.\n2. Gleam gen_server implementation.\n3. Replace toml library with Gleam implementation (file read, etc.)\n\n## Quick start\n\n```sh\n# Build the project\nrebar3 compile\n\n# Run the eunit tests\nrebar3 eunit\n\n# Run the Erlang REPL\nrebar3 shell\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpope9%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpope9%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpope9%2Fconfig/lists"}