{"id":37167907,"url":"https://github.com/yuanzhangcai/config","last_synced_at":"2026-01-14T19:51:35.112Z","repository":{"id":57534220,"uuid":"279478072","full_name":"yuanzhangcai/config","owner":"yuanzhangcai","description":"配置文件解析","archived":false,"fork":false,"pushed_at":"2021-04-20T07:04:07.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-20T13:49:40.343Z","etag":null,"topics":["config","env","json","toml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Go","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/yuanzhangcai.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}},"created_at":"2020-07-14T04:06:50.000Z","updated_at":"2021-04-20T07:01:03.000Z","dependencies_parsed_at":"2022-09-26T18:21:30.632Z","dependency_job_id":null,"html_url":"https://github.com/yuanzhangcai/config","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/yuanzhangcai/config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanzhangcai%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanzhangcai%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanzhangcai%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanzhangcai%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuanzhangcai","download_url":"https://codeload.github.com/yuanzhangcai/config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanzhangcai%2Fconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28433317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["config","env","json","toml","yaml"],"created_at":"2026-01-14T19:51:34.509Z","updated_at":"2026-01-14T19:51:35.101Z","avatar_url":"https://github.com/yuanzhangcai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# config\n[![build](https://github.com/yuanzhangcai/config/workflows/Go/badge.svg)](https://github.com/yuanzhangcai/config/actions)\n[![codecov](https://codecov.io/gh/yuanzhangcai/config/branch/master/graph/badge.svg)](https://codecov.io/gh/yuanzhangcai/config)\n[![GitHub](https://img.shields.io/github/license/yuanzhangcai/config)](https://github.com/yuanzhangcai/config/blob/master/LICENSE)\n\n配置文件解析，目前支持toml、yaml、json文件格式。支持多配置文件重载。默认初次加载所有环境变量。支持配置文件热更新。\n\nexample:\n```\n    import github.com/yuanzhangcai/config\n\n    // 加载配置\n    config.LoadFile(configFilePath + \"config.toml\")\n\n    // 读取配置参数\n    value := config.GetString(\"key\")\n\n    // 修改配置参数\n    config.Set(\"newKey\", \"value\")\n\n    value := strut {\n      List   []string `json:\"list\"`\n      Server string   `json:\"server\"`\n      Count  int      `json:\"count\"`\n    }{}\n    err = Scan([]string{\"db\"}, \u0026value)\n\n```\n\n性能压测：\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/yuanzhangcai/config\nBenchmarkGet/Get_______________-12         \t 6036589\t       196 ns/op\nBenchmarkGet/viper_Get_________-12       \t  462037\t      2604 ns/op\nBenchmarkGet/micro_config_Get__-12      \t 4340478\t       275 ns/op\nBenchmarkGet/beego_config_Get__-12      \t 2691524\t       446 ns/op\nBenchmarkGet/Parallel_Get______-12      \t18792312\t        68.7 ns/op\nBenchmarkGet/Parallel_viper_Get-12       \t 1757396\t       668 ns/op\nBenchmarkGet/Parallel_micro_Get-12       \t13200244\t        87.0 ns/op\nBenchmarkGet/Parallel_beego_Get-12       \t 9161379\t       149 ns/op\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanzhangcai%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuanzhangcai%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanzhangcai%2Fconfig/lists"}