{"id":23667037,"url":"https://github.com/dmotylev/appconfig","last_synced_at":"2025-09-01T19:32:48.807Z","repository":{"id":12380617,"uuid":"15032433","full_name":"dmotylev/appconfig","owner":"dmotylev","description":"Golang library for gathering configuration data from different sources","archived":false,"fork":false,"pushed_at":"2017-03-17T09:13:00.000Z","size":26,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T05:12:08.118Z","etag":null,"topics":["12-factor","appconfig","configuration","go"],"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/dmotylev.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":"2013-12-08T22:10:41.000Z","updated_at":"2022-04-05T09:16:11.000Z","dependencies_parsed_at":"2022-09-10T14:40:59.154Z","dependency_job_id":null,"html_url":"https://github.com/dmotylev/appconfig","commit_stats":null,"previous_names":["dmotylev/nutrition"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotylev%2Fappconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotylev%2Fappconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotylev%2Fappconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmotylev%2Fappconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmotylev","download_url":"https://codeload.github.com/dmotylev/appconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231713093,"owners_count":18415194,"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":["12-factor","appconfig","configuration","go"],"created_at":"2024-12-29T07:38:20.122Z","updated_at":"2024-12-29T07:38:23.394Z","avatar_url":"https://github.com/dmotylev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AppConfig [![Build Status](https://travis-ci.org/dmotylev/appconfig.png?branch=master)](https://travis-ci.org/dmotylev/appconfig) [![Coverage Status](https://coveralls.io/repos/dmotylev/appconfig/badge.png)](https://coveralls.io/r/dmotylev/appconfig) [![Go Report Card](https://goreportcard.com/badge/github.com/dmotylev/appconfig)](https://goreportcard.com/report/github.com/dmotylev/appconfig) [![GoDoc](https://godoc.org/github.com/dmotylev/appconfig?status.svg)](https://godoc.org/github.com/dmotylev/appconfig) \n\n```Go\nimport \"github.com/dmotylev/appconfig\"\n```\n\n## Documentation\n\nSee [GoDoc](http://godoc.org/github.com/dmotylev/appconfig).\n\n## Usage\n\nSet environment variables:\n```Bash\nAPP_TIMEOUT=1h2m3s\nAPP_WORKERNAME=Monkey\n```\n\nWrite other values to the file:\n```Bash\ncat \u003e local.conf \u003c\u003c EOF\nAPP_TIMEOUT=2h2m3s\nAPP_NUMWORKERS=10\nAPP_WORKERNAME=Robot\nEOF\n```\n\nWrite code:\n\nPopulate variable from both sources:\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/dmotylev/appconfig\"\n)\n\nfunc main() {\n\tvar conf struct {\n\t\tTimeout    time.Duration\n\t\tDay        time.Time `time,format:\"2006-01-02\"`\n\t\tWorkerName string\n\t\tNumWorkers int\n\t}\n\n\terr := appconfig.Load(\u0026conf, appconfig.FromEnv(\"APP_\"), appconfig.FromFile(\"local.conf\"))\n\n\tfmt.Printf(\"err=%v\\n\", err)\n\tfmt.Printf(\"timeout=%s\\n\", conf.Timeout)\n\tfmt.Printf(\"day=%s\\n\", conf.Day.Format(time.UnixDate))\n\tfmt.Printf(\"worker=%s\\n\", conf.WorkerName)\n\tfmt.Printf(\"workers=%d\\n\", conf.NumWorkers)\n}\n```\n\nResults:\n```Bash\nerr=\u003cnil\u003e\ntimeout=1h2m3s\nday=Fri Dec 13 00:00:00 UTC 2013\nworker=Monkey\nworkers=10\n```\n\nGet some inspiration from tests.\n\n# License\n\nThe package available under [LICENSE](https://github.com/dmotylev/appconfig/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmotylev%2Fappconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmotylev%2Fappconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmotylev%2Fappconfig/lists"}