{"id":20279161,"url":"https://github.com/peterhellberg/env","last_synced_at":"2025-07-11T14:12:52.520Z","repository":{"id":30984548,"uuid":"34542856","full_name":"peterhellberg/env","owner":"peterhellberg","description":"Load environment variables into Go types, with fallback values.","archived":false,"fork":false,"pushed_at":"2023-09-08T11:10:13.000Z","size":21,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T06:18:12.954Z","etag":null,"topics":["environment-variables","go"],"latest_commit_sha":null,"homepage":null,"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/peterhellberg.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":"2015-04-24T21:30:11.000Z","updated_at":"2024-01-17T08:53:18.000Z","dependencies_parsed_at":"2024-06-21T14:11:12.645Z","dependency_job_id":null,"html_url":"https://github.com/peterhellberg/env","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/peterhellberg/env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterhellberg","download_url":"https://codeload.github.com/peterhellberg/env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterhellberg%2Fenv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264831026,"owners_count":23670409,"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":["environment-variables","go"],"created_at":"2024-11-14T13:28:38.153Z","updated_at":"2025-07-11T14:12:52.477Z","avatar_url":"https://github.com/peterhellberg.png","language":"Go","readme":"# env\n\n[![Build status](https://github.com/peterhellberg/env/actions/workflows/test.yml/badge.svg)](https://github.com/peterhellberg/env/actions/workflows/test.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/peterhellberg/env)](https://goreportcard.com/report/github.com/peterhellberg/env)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/peterhellberg/env)\n[![License MIT](https://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat)](https://github.com/peterhellberg/env#license-mit)\n\nLoad environment variables into Go types, with fallback values.\n\nThis package is meant to be used when configuring a [twelve-factor app](http://12factor.net/).\n\nCurrently supported types are `bool`, `[]byte`, `time.Duration`, `float64`, `int`, `string`, `[]string` and `*url.URL`\n\n## Installation\n\n    go get -u github.com/peterhellberg/env\n\nFeel free to copy all or parts of this package into your own codebase.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/peterhellberg/env\"\n)\n\nfunc main() {\n\tfmt.Println(\n\t\tenv.Bool(\"BOOL\", false),\n\t\tenv.Bytes(\"BYTES\", []byte{4, 2}),\n\t\tenv.Duration(\"DURATION\", 250000),\n\t\tenv.Float64(\"FLOAT64\", float64(2.5)),\n\t\tenv.Int(\"INT\", 1337),\n\t\tenv.String(\"STRING\", \"Foobar\"),\n\t\tenv.Strings(\"STRINGS\", []string{\"Foo\", \"Bar\"}),\n\t\tenv.URL(\"URL\", \u0026url.URL{Scheme: \"http\", Host: \"example.com\"}),\n\t)\n}\n```\n\n```bash\n$ go run example.go\nfalse [4 2] 250µs 2.5 1337 Foobar [Foo Bar] http://example.com\n\n$ BOOL=true BYTES=foo DURATION=24m FLOAT64=11.2 INT=2600 STRING=hello STRINGS=a,b URL=http://c7.se/ go run example.go\ntrue [102 111 111] 24m0s 11.2 2600 hello [a b] http://c7.se/\n```\n\n## License (MIT)\n\nCopyright (c) 2015-2023 [Peter Hellberg](https://c7.se)\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining\n\u003e a copy of this software and associated documentation files (the\n\u003e \"Software\"), to deal in the Software without restriction, including\n\u003e without limitation the rights to use, copy, modify, merge, publish,\n\u003e distribute, sublicense, and/or sell copies of the Software, and to\n\u003e permit persons to whom the Software is furnished to do so, subject to\n\u003e the following conditions:\n\n\u003e The above copyright notice and this permission notice shall be\n\u003e included in all copies or substantial portions of the Software.\n\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\u003e EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\u003e MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n\u003e NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n\u003e LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n\u003e OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n\u003e WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterhellberg%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterhellberg%2Fenv/lists"}