{"id":15089301,"url":"https://github.com/insei/tinyconf","last_synced_at":"2025-10-10T14:33:14.677Z","repository":{"id":247580922,"uuid":"825946731","full_name":"Insei/tinyconf","owner":"Insei","description":"Driver based configuration reader with config documentation auto generation","archived":false,"fork":false,"pushed_at":"2025-03-26T15:45:37.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T21:53:13.845Z","etag":null,"topics":["config","configuration","env","parser","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Insei.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2024-07-08T20:12:50.000Z","updated_at":"2025-03-26T15:45:14.000Z","dependencies_parsed_at":"2024-07-09T14:36:15.861Z","dependency_job_id":"18e1f032-5824-4aff-924c-49b3c7872b12","html_url":"https://github.com/Insei/tinyconf","commit_stats":{"total_commits":10,"total_committers":4,"mean_commits":2.5,"dds":0.6,"last_synced_commit":"d58bb6febcf89acb74b4fbdecdcb48a900adc56a"},"previous_names":["insei/tinyconf"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/Insei/tinyconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Insei%2Ftinyconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Insei%2Ftinyconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Insei%2Ftinyconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Insei%2Ftinyconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Insei","download_url":"https://codeload.github.com/Insei/tinyconf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Insei%2Ftinyconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004176,"owners_count":26083688,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config","configuration","env","parser","yaml"],"created_at":"2024-09-25T08:44:23.451Z","updated_at":"2025-10-10T14:33:14.659Z","avatar_url":"https://github.com/Insei.png","language":"Go","readme":"[![codecov](https://codecov.io/gh/Insei/tinyconf/graph/badge.svg?token=TSOJ1SWF9D)](https://codecov.io/gh/Insei/tinyconf)\n[![build](https://github.com/insei/tinyconf/actions/workflows/go.yml/badge.svg)](https://github.com/Insei/tinyconf/actions/workflows/go.yml)\n[![Goreport](https://goreportcard.com/badge/github.com/insei/tinyconf)](https://goreportcard.com/report/github.com/insei/tinyconf)\n[![GoDoc](https://godoc.org/github.com/insei/tinyconf?status.svg)](https://godoc.org/github.com/insei/tinyconf)\n# tinyconf\ntinyconf - a simple and universal library for parsing configs.\n\n# Installation\nInstall via go get. Note that Go 1.19 or newer is required.\n```sh\ngo get github.com/insei/tinyconf@latest\n```\n\n# Description\ntinyconf parses the config and returns the config structure. When initializing tinyconf.Manager, you can add a logger to it, as well as drivers (for priority in parsing the config, i.e. it will check them starting from the last one you specified). You can also add your own driver.\n\ntinyconf.Manager has methods:\n```\nRegister(conf any) error\nParse(conf any) error \n```\nwhere: \u003cbr\u003e\n`Register(conf any) error` - registers map[strings]fmap.Field for the config.\u003cbr\u003e\n`Parse(conf any) error` - parses config from registered drivers.\u003cbr\u003e\n\n# Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/google/uuid\"\n\t\"github.com/insei/tinyconf\"\n\t\"tinyconf/drivers/env\"\n\t\"tinyconf/drivers/tag\"\n\t\"tinyconf/drivers/yaml\"\n\t\"tinyconf/logger\"\n)\n\ntype Embedded struct {\n\tTest string `initial:\"Shakalaka\"`\n}\n\ntype DefConf struct {\n\tEmbedded Embedded\n\tTest     string    `initial:\"123\" yaml:\"test\" env:\"DEFAULT_TEST\"`\n\tTest2    int       `initial:\"123\"  yaml:\"test2\"`\n\tTest3    int32     `initial:\"2\" yaml:\"test3,omitempty\"`\n\tTest4    *int32    `initial:\"3\" yaml:\"test4,omitempty\"`\n\tTest5    *string   `initial:\"*string\" yaml:\"test5,omitempty\" env:\"DEFAULT_TEST\"`\n\tTest6    string    `yaml:\"test6,omitempty\"`\n\tTest7    uuid.UUID `initial:\"f9a49892-860e-48ec-b927-73f9d2560eec\"`\n\tPassword string    `initial:\"Qwerty\" yaml:\"password\" hidden:\"true\"`\n}\n\nfunc main() {\n\tyamlDriver, err := yaml.New(\"config.yaml\")\n\tif err != nil {\n\t\treturn\n\t}\n\tenvDriver, err := env.New()\n\tif err != nil {\n\t\treturn\n\t}\n\ttagDriver, err := tag.New(\"initial\")\n\tif err != nil {\n\t\treturn\n\t}\n\tconfig, err := tinyconf.New(\n\t\ttinyconf.WithLogger(logger.NewFmtLogger(logger.TRACE)),\n\t\ttinyconf.WithDriver(tagDriver),\n\t\ttinyconf.WithDriver(yamlDriver),\n\t\ttinyconf.WithDriver(envDriver),\n\t)\n\tif err != nil {\n\t\treturn\n\t}\n\tc := DefConf{\n\t\tEmbedded: Embedded{},\n\t\tTest:     \"Tests\",\n\t\tTest2:    22,\n\t\tTest3:    0,\n\t\tTest4:    nil,\n\t\tTest5:    nil,\n\t\tTest6:    \"\",\n\t\tTest7:    uuid.UUID{},\n\t\tPassword: \"\",\n\t}\n\terr = config.Register(\u0026c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(config.GenDoc(\"yaml\"))\n\terr = config.Parse(\u0026c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Print(c)\n}\n```\n\nMore examples in `parser_test.go` and others test files.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsei%2Ftinyconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finsei%2Ftinyconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finsei%2Ftinyconf/lists"}