{"id":19383358,"url":"https://github.com/mdouchement/koanfgo","last_synced_at":"2025-09-19T06:12:36.043Z","repository":{"id":79844332,"uuid":"250869149","full_name":"mdouchement/koanfgo","owner":"mdouchement","description":"Koanf Go allows to write dynamic configuration files for koanf configuration manager.","archived":false,"fork":false,"pushed_at":"2023-02-04T12:51:07.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T06:50:12.084Z","etag":null,"topics":["configuration","configuration-management","configuration-parser","go","golang","koanf"],"latest_commit_sha":null,"homepage":null,"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/mdouchement.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-03-28T18:45:44.000Z","updated_at":"2024-03-30T03:50:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"e76f159f-51d3-49e2-bed3-be6d0ca3db75","html_url":"https://github.com/mdouchement/koanfgo","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/mdouchement%2Fkoanfgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fkoanfgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fkoanfgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fkoanfgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdouchement","download_url":"https://codeload.github.com/mdouchement/koanfgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240521052,"owners_count":19814694,"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":["configuration","configuration-management","configuration-parser","go","golang","koanf"],"created_at":"2024-11-10T09:25:45.234Z","updated_at":"2025-09-19T06:12:31.018Z","avatar_url":"https://github.com/mdouchement.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koanf Go(lang)\n\nKoanf Go(lang) allows to write dynamic configuration files for [koanf](https://github.com/knadh/koanf) configuration manager. Sometimes dynamic configuration is required.\n\nBased on the idea of https://github.com/mdouchement/koanflua.\n\n## Usage\n\n```go\n// config.go\npackage config\n\nimport (\n\t\"maps\" // https://github.com/containous/yaegi/issues/327\n\t\"os\"\n)\n\nfunc Load() (map[string]interface{}, error) {\n\tconfig := map[string]interface{}{\n\t\t\"brokers\": []string{\"localhost:42\", \"localhost:4242\"},\n\t\t\"listen\":  \"localhost\",\n\t\t\"redis\": map[string]interface{}{\n\t\t\t\"addr\":     \"localhost:6379\",\n\t\t\t\"password\": \"trololo\",\n\t\t\t\"db\":       1,\n\t\t},\n\t}\n\n\tif os.Getenv(\"MAGIC_FEATURE\") == \"enabled\" {\n\t\tmaps.Set(config, \"feature\", \"testouille\")\n\t}\n\n\treturn config, nil\n}\n```\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/knadh/koanf\"\n\t\"github.com/knadh/koanf/providers/file\"\n\t\"github.com/mdouchement/koanfgo\"\n)\n\nfunc main() {\n\tkonf := koanf.New(\".\")\n\terr := konf.Load(file.Provider(\"config.go\"), koanfgo.Parser())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t//\n\n\tredisAddr := konf.String(\"redis.addr\")\n\tfmt.Println(redisAddr)\n}\n```\n\n## Resources\n\n- Yaegi is Another Elegant Go Interpreter: https://github.com/containous/yaegi\n\n## License\n\n**MIT**\n\n\n## Contributing\n\nAll PRs are welcome.\n\n1. Fork it\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n5. Push to the branch (git push origin my-new-feature)\n6. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdouchement%2Fkoanfgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdouchement%2Fkoanfgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdouchement%2Fkoanfgo/lists"}