{"id":27786271,"url":"https://github.com/clever/configure","last_synced_at":"2025-10-04T14:17:36.653Z","repository":{"id":42640257,"uuid":"49524520","full_name":"Clever/configure","owner":"Clever","description":"Seamlessly configure applications with either flags or JSON","archived":false,"fork":false,"pushed_at":"2025-04-24T19:43:49.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-04-24T20:38:25.210Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-01-12T19:40:21.000Z","updated_at":"2025-04-24T19:43:54.000Z","dependencies_parsed_at":"2025-04-24T20:31:03.985Z","dependency_job_id":"c898eabf-938a-4cb5-ac1f-3bf0ee8080c5","html_url":"https://github.com/Clever/configure","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fconfigure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fconfigure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fconfigure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fconfigure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clever","download_url":"https://codeload.github.com/Clever/configure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251737753,"owners_count":21635665,"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":[],"created_at":"2025-04-30T15:58:44.351Z","updated_at":"2025-10-04T14:17:31.601Z","avatar_url":"https://github.com/Clever.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# configure\n\nEasily fill in a configuration struct with either flag arguments or a JSON blob argument.\n\n\n## Usage\n\nGiven a simple program that uses two arguments, `district_id` and `collection`:\n\n```go\nvar config struct {\n\tDistrictID string `config:\"district_id,required\"`\n\tCollection string `config:\"collection\"`\n}\n\nfunc main() {\n\tif err := configure.Configure(\u0026config); err != nil {\n\t\tlog.Fatalf(\"err: %#v\", err)\n\t}\n\tlog.Printf(\"config: %#v\", config)\n\n\t// go use arguments to do something\n}\n```\n\nIt can be invoked two styles:\n\n```bash\n./example -h\nUsage of ./example:\n  -collection string\n      generated field\n  -district_id string\n      generated field\n\n./example -district_id=\"abc123\"\n\u003e config: {DistrictID:abc123 Collection:}\n\n./example '{\"district_id\":\"abc123\",\"collection\":\"schools\"}'\n\u003e config: {DistrictID:abc123 Collection:schools}\n\n./example -district_id=\"abc123\" -collection=\"schools\"\n\u003e config: {DistrictID:abc123 Collection:schools}\n\n# fails when not provided with the required district_id argument\n./example -collection=schools\n\u003e err: Missing required fields: [district_id]\n\n./example '{\"collection\":\"schools\"}'\n\u003e err: Missing required fields: [district_id]\n```\n\n### Defining defaults\n\nYou can also define defaults by passing a pre-populated struct:\n\n```go\nfunc main() {\n\tconfig := struct {\n\t\tDistrictID string `config:\"district_id,required\"`\n\t\tCollection string `config:\"collection\"`\n\t}{\n\t\tCollection: \"default-collection\",\n\t}\n\n\tif err := configure.Configure(\u0026config); err != nil {\n\t\tlog.Fatalf(\"err: %#v\", err)\n\t}\n\tlog.Printf(\"config: %#v\\n\", config)\n\n\t// go use arguments to do something\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fconfigure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever%2Fconfigure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fconfigure/lists"}