{"id":22322455,"url":"https://github.com/josestg/getenv","last_synced_at":"2025-03-26T05:11:25.142Z","repository":{"id":224317857,"uuid":"759316552","full_name":"josestg/getenv","owner":"josestg","description":"A type-safe wrapper for os.Getenv that returns a default value if the environment variable is not set.","archived":false,"fork":false,"pushed_at":"2024-02-28T12:45:15.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T06:47:02.459Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josestg.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":"2024-02-18T08:47:22.000Z","updated_at":"2024-07-16T07:32:06.000Z","dependencies_parsed_at":"2025-01-31T06:47:06.915Z","dependency_job_id":"cd3d83b4-84c6-4809-bcb2-39fe211dabab","html_url":"https://github.com/josestg/getenv","commit_stats":null,"previous_names":["josestg/getenv"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fgetenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fgetenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fgetenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fgetenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josestg","download_url":"https://codeload.github.com/josestg/getenv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245591624,"owners_count":20640692,"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":"2024-12-04T01:07:27.358Z","updated_at":"2025-03-26T05:11:25.123Z","avatar_url":"https://github.com/josestg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# getenv\n\nA type-safe wrapper for `os.Getenv` that returns a default value if the environment variable is not set.\n\n\n## Installation\n\n```bash\ngo get github.com/josestg/getenv\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n\n    \"github.com/josestg/getenv\"\n)\n\nfunc main() {\n    var (\n        host             = getenv.String(\"HOST\", \"0.0.0.0\")\n        ports            = getenv.Ints(\"PORTS\", []int{8080, 8081, 8082})\n        debug            = getenv.Bool(\"DEBUG\", false)\n        threshold        = getenv.Float(\"THRESHOLD\", 0.5)\n        maxBodySize      = getenv.Int(\"MAX_BODY_SIZE\", uint64(1\u003c\u003c20)) // 1MB\n        shutdownTimeout  = getenv.Duration(\"SHUTDOWN_TIMEOUT\", 5*time.Second)\n        whitelistHeaders = getenv.Strings(\"WHITELIST_HEADERS\", []string{\"Content-Type\", \"Content-Length\"})\n    )\n\n    fmt.Println(\n        host,\n        ports,\n        debug,\n        threshold,\n        maxBodySize,\n        shutdownTimeout,\n        whitelistHeaders,\n    )\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Fgetenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosestg%2Fgetenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Fgetenv/lists"}