{"id":37151403,"url":"https://github.com/zxdev/env","last_synced_at":"2026-01-14T17:53:02.454Z","repository":{"id":248145466,"uuid":"827145777","full_name":"zxdev/env","owner":"zxdev","description":"a simple struct parser for configuation with associated bootstap service managers","archived":false,"fork":false,"pushed_at":"2025-02-28T11:45:40.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T18:14:17.088Z","etag":null,"topics":["bootstrap","configuration","env","environment","struct"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zxdev.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-07-11T05:15:23.000Z","updated_at":"2025-02-28T11:45:30.000Z","dependencies_parsed_at":"2024-08-09T00:23:53.751Z","dependency_job_id":"28c1915b-f246-4c25-84c6-ad18e8f33874","html_url":"https://github.com/zxdev/env","commit_stats":null,"previous_names":["zxdev/env"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/zxdev/env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxdev%2Fenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxdev%2Fenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxdev%2Fenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxdev%2Fenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zxdev","download_url":"https://codeload.github.com/zxdev/env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zxdev%2Fenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28428963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bootstrap","configuration","env","environment","struct"],"created_at":"2026-01-14T17:53:01.814Z","updated_at":"2026-01-14T17:53:02.449Z","avatar_url":"https://github.com/zxdev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# env package\n\nDesigned to provide simple and useful tooling to popoulate simple structs and provide managagement and helpful services utilizing struct tags instead of package like flag or third-party solutions.\n\n\n```golang\ntype params struct {\n\tAction    string `env:\"A,require,order\" help:\"a name to use\"`\n\tSecret    string `env:\"hidden\" help:\"a secret\"`\n\tFlag      bool   `default:\"on\"  help:\"a flag setting\"`\n\tNumber    int    `default:\"5\" help:\"a number\"`\n\ttimestamp int64  // not parsed or reported in Summary\n}\n\nfunc main() {\n\tvar param params\n\tpaths := env.NewEnv(\u0026param)\n}\n\n```\n\nSet struct params and populate by calling ```env.NewEnv(\u0026param)``` to parse and populate the struct as shown.\n* Any default value is overloaded by system environment that is in turn overloaded by any command line values. \n\nSupported types in env.Parser are limited to ```string```, ```bool```, and ```int```. \n* Bool understands and accepts: ```on```, ```yes```, ```ok```, ```true```, and ```1``` and their associated negative counter parts. \n* Everything you want can be derived from these three basic types, including arrays and maps that utilize your own encoding and decoding.\n\t* Array can be passed or set as ```one,two,three``` and split by on comman, simarly a map can be encode as ```k1:v1,k1:v2``` and decoded by splitting on comma and then each set split on the colon.\n\n---\n\nStruct tag element supported and descriptions.\n\n* ```env```: alias,order,require,environ,hidden\n\t* alias support can be short form of the switch ```-A``` instead of ```-action```\n\t* order makes it switchless and populated based on os.Args location index\n\t* require will cause hard stop when not defaulted or provided\n\t* environ sets all struct elements in the system envronment\n\t* hidden redacts the struct value in the summary report \n\n* ```default```: string, bool, int values\n* ```help```: description\n\nAutomatic ```-help``` support reports basic information, the struct field name, the alias is any, the env:tag in use, any default value and the help description.\n\n```\n % go run example/main.go -help\n\n development\n--------------------\n version \n build   \n\n action         A     [or  ] default:           an action to do\n secret               [   *] default:           a secret\n flag                 [    ] default:on         a flag setting\n number               [    ] default:5          a number\n\n```\n\nA summary log reports the struct values and integrates with other env system. If more than one param is populated by env.NewENV(\u0026param,\u0026server), each will appear as seperate sets in the order provided in the log summary output.\n\n```\n\n% go run example/main.go run   \n2024/07/10 21:19:54 |----------------------------------------|\n2024/07/10 21:19:54 | MAIN ::::::::::::::::::::::: event log |\n2024/07/10 21:19:54 |-----//o--------------------------------|\n2024/07/10 21:19:54                                 version\n2024/07/10 21:19:54                                 build\n2024/07/10 21:19:54                             pid 65812\n2024/07/10 21:19:54 |-----//o--------------------------------|\n2024/07/10 21:19:54  action         | run\n2024/07/10 21:19:54  secret         | \u003chidden\u003e\n2024/07/10 21:19:54  flag           | true\n2024/07/10 21:19:54  number         | 5\n2024/07/10 21:19:54 |----------------------------------------|\n2024/07/10 21:19:54 _dev/srv\n2024/07/10 21:19:54 sample: start\n2024/07/10 21:19:55 main: bootstrap complete\n2024/07/10 21:19:58 main: interrupt shutdown\n2024/07/10 21:19:58 sample: stop\n2024/07/10 21:19:58 main: shutdown initiated\n2024/07/10 21:19:58 |----------------------------------------|\n2024/07/10 21:19:58 main: bye\n2024/07/10 21:19:58 |----------------------------------------|\n\n\n```\n\n* env.NewEnv - parse and populate a param struct\n* env.Parser - parser used with NewEnv methods\n\n* env.Dir - ensure a directory exists\n* env.Expire - expiration file manager with graceful interface support\n* env.Graceful - graceful startup/shutdown controller\n* env.Lock - process file lock (simple in use detection)\n* env.Persist - persist and resume with data on disk\n* env.Shutdown - shutdown, not necessary with graceful controller\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxdev%2Fenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzxdev%2Fenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzxdev%2Fenv/lists"}