{"id":31822905,"url":"https://github.com/devfans/envconf","last_synced_at":"2025-10-11T14:20:24.450Z","repository":{"id":57531954,"uuid":"138138761","full_name":"devfans/envconf","owner":"devfans","description":"bootstrap for easily operate on config file \u0026 env","archived":false,"fork":false,"pushed_at":"2025-08-11T11:25:29.000Z","size":45,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-11T13:13:50.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devfans.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":"2018-06-21T08:01:00.000Z","updated_at":"2025-08-11T11:23:10.000Z","dependencies_parsed_at":"2024-06-15T03:28:46.760Z","dependency_job_id":"78571f11-98e8-4dca-93b2-1a0e113ca150","html_url":"https://github.com/devfans/envconf","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/devfans/envconf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fenvconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fenvconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fenvconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fenvconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devfans","download_url":"https://codeload.github.com/devfans/envconf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfans%2Fenvconf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007496,"owners_count":26084313,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-10-11T14:20:18.900Z","updated_at":"2025-10-11T14:20:24.445Z","avatar_url":"https://github.com/devfans.png","language":"Go","readme":"# envconf\n\n[![Build Status](https://travis-ci.org/devfans/envconf.svg?branch=master)](https://travis-ci.org/devfans/envconf)\n[![Go Report Card](https://goreportcard.com/badge/github.com/devfans/envconf)](https://goreportcard.com/report/github.com/devfans/envconf)\n[![GoDoc](https://godoc.org/github.com/devfans/envconf?status.svg)](https://godoc.org/github.com/devfans/envconf) [![Join the chat at https://gitter.im/devfans/envconf](https://badges.gitter.im/devfans/envconf.svg)](https://gitter.im/devfans/envconf?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nBoostrap for operations with config file or env variables.\nRead/Save config files like \"~/.app\" with sections and Set/Get env variables.\n\n# Get Started\n\nConfig file sample:\n```\n[main]\nname = test # comment\n\n[server]\n\n[client]\n```\n\nUsages:\n```\nimport \"github.com/devfans/envconf\"\n\nfunc main() {\n  config := envconf.NewConfig(\"~/.app\")\n\n  // get name key from config from default section: [main]\n  name := config.Get(\"name\")\n\n  // get sections\n  server := config.GetSection(\"server\")\n  client := config.GetSection(\"client\")\n\n  // add new keys\n  server.Put(\"ip\", \"localhost\")\n  client.Put(\"ip\", \"0.0.0.0\")\n\n  // save to disk as file \"~/.app\"\n  config.Save() \n  \n  // other usages\n  config.Section = \"server\"     // switch current section\n  serverIp := config.String(\"ip\")  // localhost\n\n  config.Get(\"SERVER_IP\", \"ip\") // get env first if env variable is not null\n\n  config.Getenv(\"SERVER_IP\")\n  config.Setenv(\"SERVER_IP\", \"localhost\")\n}\n```\n\n## dotenv\n\n```\n# file: .env\n\n[main]\nuse_section = case1\n\n[case1]\nname = a\n\n[case2]\nname = b\n\n```\n\nExample\n\n```\n\nimport (\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/devfans/envconf/dotenv\"\n)\n\nfunc TestEnv(t *testing.T) {\n\tt.Log(os.Getenv(\"a\"))\n\tt.Log(os.Getenv(\"b\"))\n\tt.Log(dotenv.Int(\"a\"))\n\tt.Log(dotenv.Uint(\"b\"))\n\tt.Log(dotenv.Bool(\"c\"))\n\tt.Log(dotenv.Bool(\"d\"))\n\tt.Log(os.Getenv(\"test\"))\n\tt.Log(dotenv.String(\"test\"))\n\tt.Log(dotenv.EnvConf().Get(\"a\"))\n\tt.Log(dotenv.EnvConf().Get(\"b\"))\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfans%2Fenvconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevfans%2Fenvconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfans%2Fenvconf/lists"}