{"id":14087123,"url":"https://github.com/crgimenes/goConfig","last_synced_at":"2025-07-31T11:31:00.078Z","repository":{"id":15341702,"uuid":"497806496","full_name":"crgimenes/config","owner":"crgimenes","description":"Configuration loader to use in Go projects","archived":false,"fork":false,"pushed_at":"2024-05-04T10:30:14.000Z","size":221,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-29T21:20:13.728Z","etag":null,"topics":["config","go","golang"],"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/crgimenes.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":"2022-05-30T05:49:16.000Z","updated_at":"2024-06-20T21:52:23.504Z","dependencies_parsed_at":"2024-06-20T21:52:20.502Z","dependency_job_id":"0b197baa-d86f-4107-86f8-450973c7a150","html_url":"https://github.com/crgimenes/config","commit_stats":{"total_commits":257,"total_committers":16,"mean_commits":16.0625,"dds":0.0933852140077821,"last_synced_commit":"9172e7d8bc62ee07fd8bd2e61d21df5448b5bf34"},"previous_names":["crgimenes/goconfig"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crgimenes%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crgimenes","download_url":"https://codeload.github.com/crgimenes/config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228242103,"owners_count":17890472,"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":["config","go","golang"],"created_at":"2024-08-13T22:00:59.507Z","updated_at":"2024-12-05T05:30:41.112Z","avatar_url":"https://github.com/crgimenes.png","language":"Go","funding_links":[],"categories":["Configuration","配置管理 `配置解析库`","配置","\u003cspan id=\"组态-configuration\"\u003e组态 Configuration\u003c/span\u003e","配置管理"],"sub_categories":["Advanced Console UIs","Standard CLI","标准CLI","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","标准 CLI"],"readme":"# config\n\n[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)\n\nconfig uses a struct as input and populates the fields of this struct with parameters from command line, environment variables and configuration file.\n\n## Install\n\n```\ngo get crg.eti.br/go/config\n```\n\n## Example\n\n```go\npackage main\n\nimport \"crg.eti.br/go/config\"\n\n/*\nstep 1: Declare your configuration struct,\nit may or may not contain substructures.\n*/\n\ntype mongoDB struct {\n Host string `cfgDefault:\"example.com\" cfgRequired:\"true\"`\n Port int    `cfgDefault:\"999\"`\n}\n\ntype configTest struct {\n Domain    string\n DebugMode bool `json:\"db\" cfg:\"db\" cfgDefault:\"false\"`\n MongoDB   mongoDB\n IgnoreMe  string `cfg:\"-\"`\n}\n\nfunc main() {\n\n // step 2: Instantiate your structure.\n config := configTest{}\n\n // step 3: Pass the instance pointer to the parser\n err := config.Parse(\u0026config)\n if err != nil {\n  println(err)\n  return\n }\n\n /*\n    The parser populated your struct with the data\n    it took from environment variables and command\n    line and now you can use it.\n */\n\n println(\"config.Domain......:\", config.Domain)\n println(\"config.DebugMode...:\", config.DebugMode)\n println(\"config.MongoDB.Host:\", config.MongoDB.Host)\n println(\"config.MongoDB.Port:\", config.MongoDB.Port)\n}\n```\n\nWith the example above try environment variables like *$DOMAIN* or *$MONGODB_HOST* and run the example again to see what happens.\n\nYou can also try using parameters on the command line, try -h to see the help.\n\n## Contributing\n\n- Fork the repo on GitHub\n- Clone the project to your own machine\n- Create a *branch* with your modifications `git checkout -b fantastic-feature`.\n- Then *commit* your changes `git commit -m 'Implementation of new fantastic feature'`\n- Make a *push* to your *branch* `git push origin fantastic-feature`.\n- Submit a **Pull Request** so that we can review your changes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrgimenes%2FgoConfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrgimenes%2FgoConfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrgimenes%2FgoConfig/lists"}