{"id":17101746,"url":"https://github.com/nicholasjackson/env","last_synced_at":"2025-04-13T00:25:48.548Z","repository":{"id":57490567,"uuid":"154984966","full_name":"nicholasjackson/env","owner":"nicholasjackson","description":"Package to provide configuration as environment variables for 12 factor applications","archived":false,"fork":false,"pushed_at":"2023-01-26T18:00:13.000Z","size":13,"stargazers_count":44,"open_issues_count":0,"forks_count":23,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T18:21:26.006Z","etag":null,"topics":["environment-variables","go","microservices"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicholasjackson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-27T16:24:37.000Z","updated_at":"2025-03-14T17:15:32.000Z","dependencies_parsed_at":"2023-02-14T20:10:52.229Z","dependency_job_id":null,"html_url":"https://github.com/nicholasjackson/env","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjackson%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjackson%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjackson%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicholasjackson%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicholasjackson","download_url":"https://codeload.github.com/nicholasjackson/env/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248649720,"owners_count":21139538,"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","microservices"],"created_at":"2024-10-14T15:26:39.880Z","updated_at":"2025-04-13T00:25:48.497Z","avatar_url":"https://github.com/nicholasjackson.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Env \n\nEnv is a simple package providing configuration as environment variables for 12 factor applications, inspired by the Go `flag` package.\n\n## Basic usage\n\n```go\npackage main\n\nvar bindAddress = env.String(\"BIND_ADDRESS\",true,\"\",\"bind address for server, i.e. localhost\")\nvar bindPort = env.Integer(\"BIND_Port\",true,0,\"bind port for server, i.e. 9090\")\n\nfunc main() {\n  err := env.Parse()\n  if err != nil {\n    fmt.Println(err.Error())\n    os.Exit(1)\n  }\n\n  fmt.Println(\"bind address:\", *bindAddress)\n  fmt.Println(\"bind port:\", *bindPort)\n}\n```\n\n## Showing help menu\n\nConfiguring an application with environment variables can be confusing to the user as often the configuration options are listed in the documentation rather than accessible from the command line like flag based configuration.  Env has a built in help menu which can be accessed using the `--help` command line flag.\n\n```go\nvar bindAddress = env.String(\"BIND_ADDR\", false, \"localhost:9090\", \"Bind address for the server, i.e. localhost:9090\")\nvar cacheURI = env.String(\"CACHE_URI\", true, \"\", \"URI for the cache server, i.e. localhost:9090\")\n\nfunc main() {\n  err := env.Parse()\n```\n\n```shell\n➜ BIND_PORT=9090 BIND_ADDRESS=localhost go run main.go --help\nConfiguration values are set using environment variables, for info please see the following list.\n\nEnvironment variables:\n  BIND_ADDRESS  default: no default\n       bind address for server, i.e. localhost\n  BIND_PORT  default: '0'\n       bind port for server, i.e. 9090\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicholasjackson%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicholasjackson%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicholasjackson%2Fenv/lists"}