{"id":26222186,"url":"https://github.com/walles/env","last_synced_at":"2025-07-06T18:35:09.977Z","repository":{"id":65331889,"uuid":"588877254","full_name":"walles/env","owner":"walles","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-11T07:25:45.000Z","size":22,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T08:15:55.172Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/walles.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":"2023-01-14T10:30:41.000Z","updated_at":"2024-03-11T16:35:45.000Z","dependencies_parsed_at":"2024-06-21T05:47:51.643Z","dependency_job_id":"7b317b6d-2e3a-4fef-b122-9a06b893b6ed","html_url":"https://github.com/walles/env","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"19fd38c926e76cfde02aa873ae2f3e3733548751"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/walles/env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walles%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walles%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walles%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walles%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walles","download_url":"https://codeload.github.com/walles/env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walles%2Fenv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263952259,"owners_count":23534878,"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-03-12T16:51:30.480Z","updated_at":"2025-07-06T18:35:09.955Z","avatar_url":"https://github.com/walles.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI Status](https://github.com/walles/env/actions/workflows/ci.yml/badge.svg?branch=main)\n\nFunctions for parsing environment variable values into typed variables.\n\n# Examples\n\nNote that the resulting values are all typed.\n\n```go\nimport \"github.com/walles/env\"\n\n// Enabled will be of type bool\nenabled := env.GetOr(\"ENABLED\", strconv.ParseBool, false)\n\n// Duration will be of type time.Duration\nduration, err := env.Get(\"TIMEOUT\", time.ParseDuration)\n\n// Username will be of type string. If it's not set in the environment,\n// then MustGet will panic.\nusername := env.MustGet(\"USERNAME\", env.String)\n\n// LuckyNumbers will be of type []int\nluckyNumbers, err := env.Get(\"LUCKY_NUMBERS\", env.ListOf(strconv.Atoi, \",\"))\n\n// FluffyNumber will be a 64 bit precision float\nfluffyNumber, err := env.Get(\"FLOAT\", env.WithBitSize(strconv.ParseFloat, 64))\n\n// This will parse both hex and decimal into an uint64\n//\n// Some allowed number formats: 0xC0de, 1234\nnumber, err := env.Get(\"HEX\", env.WithBaseAndBitSize(strconv.ParseUint, 0, 64))\n\n// Timestamp will be of type time.Time\ntimestamp, err := env.Get(\"TIMESTAMP\", env.WithTimeSpec(time.Parse, time.RFC3339))\n\n// UsersAndScores will be of type map[string]int.\n//\n// In this case, \"Adam:50,Eva:60\" will be parsed into { \"Adam\":50, \"Eva\":60 }.\nusersAndScores, err := env.Get(\"USERS_AND_SCORES\", Map(env.String, \":\", strconv.Atoi, \",\"))\n```\n\n# Installing\n\nTo add to your `go.mod` file:\n\n```\ngo get github.com/walles/env\n```\n\n# Alternatives\n\nIf you like bindings based APIs better then these ones seem popular:\n\n* \u003chttps://github.com/kelseyhightower/envconfig\u003e\n* \u003chttps://github.com/caarlos0/env\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalles%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalles%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalles%2Fenv/lists"}