{"id":42180192,"url":"https://github.com/cinar/config2","last_synced_at":"2026-01-26T22:03:22.969Z","repository":{"id":57595805,"uuid":"374468724","full_name":"cinar/config2","owner":"cinar","description":"Config2 is a lightweight Golang module for managing and populating application configuration from JSON, command line, and env variables.","archived":false,"fork":false,"pushed_at":"2021-10-10T19:29:28.000Z","size":15,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T21:39:42.795Z","etag":null,"topics":["configuration","configuration-management","golang","golang-package"],"latest_commit_sha":null,"homepage":"","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/cinar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-06T21:37:33.000Z","updated_at":"2021-10-10T19:29:31.000Z","dependencies_parsed_at":"2022-09-26T20:01:19.033Z","dependency_job_id":null,"html_url":"https://github.com/cinar/config2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cinar/config2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinar%2Fconfig2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinar%2Fconfig2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinar%2Fconfig2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinar%2Fconfig2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cinar","download_url":"https://codeload.github.com/cinar/config2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cinar%2Fconfig2/sbom","scorecard":{"id":282860,"data":{"date":"2025-08-11","repo":{"name":"github.com/cinar/config2","commit":"8afbd16b587536336d39d96a56eb0b98a375ca4c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T16:22:06.576Z","repository_id":57595805,"created_at":"2025-08-17T16:22:06.576Z","updated_at":"2025-08-17T16:22:06.576Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28789721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: 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":["configuration","configuration-management","golang","golang-package"],"created_at":"2026-01-26T22:02:19.749Z","updated_at":"2026-01-26T22:03:22.955Z","avatar_url":"https://github.com/cinar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/cinar/config2?status.svg)](https://godoc.org/github.com/cinar/config2)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://travis-ci.com/cinar/config2.svg?branch=master)](https://travis-ci.com/cinar/config2)\n\n# Config2 Go\n\nConfig2 is a lightweight Golang module for managing and populating application configuration from JSON, command line, and environment variables.\n\n## Usage\n\nInstall package.\n\n```bash\ngo get github.com/cinar/config2\n```\n\nImport Config2.\n\n```Golang\nimport (\n  \"github.com/cinar/config2\n)\n```\n\nDefine a configuration structure as shown below.\n\n```Golang\ntype Config struct {\n\tHost  string `usage:\"Server hostname\"`\n\tPort  int    `usage:\"Server port\"`\n\tDebug bool   `usage:\"Enable debug\"`\n}\n```\n\nConfig2 provides the following field tags to define additional information for configuration variables.\n\nTag | Description | Example\n--- | --- | ---\nusage | Usage for command line help. | `usage:\"Server hostname\"\n\nSet the default values for the configuration variables.\n\n```Golang\nconfig := \u0026Config{Port: 8080}\n```\n### Read from command line arguments\n\nConfig2 can automatically generate a FlagSet for your configuration structure and parse the command line arguments.\n\nApplication can be launched with command line arguments.\n\n```\n./main -Debug -Host localhost -Port 9090\n```\n\nUse the [ParseCommandLine](https://pkg.go.dev/github.com/cinar/config2#ParseCommandLine) function to parse the command line arguments as shown below.\n\n```Golang\nflagSet := config2.ParseCommandLine(os.Args, config)\n```\n\nValidate the configuration variables. In case of an error, show the usage through the returned FlagSet as shown below.\n\n```Golang\nflagSet.PrintDefaults()\n```\n\nThe command line arguments, their usage, and their defaults will be shown by the FlagSet as usual.\n\n```\n  -Debug\n        Enable debug (default false)\n  -Host\n        Server hostname\n  -Port\n        Server port (default 8080)\n```\n### Read from environment variables\n\nConfig2 can read configuration from the environment variables.\n\nApplication can be launched with the environment variables set as shown below.\n\n```bash\nexport test_Host=localhost\nexport test_Port=9090\nexport test_Debug=true\n\n./main\n```\n\nUse the [ParseEnvironmentVariables](https://pkg.go.dev/github.com/cinar/config2#ParseEnvironmentVariables) function to parse the environment variables. The function takes a prefix for the environment variables. Please set it to empty string (\"\") if no prefix is needed. \n\n```Golang\nconfig2.ParseEnvironmentVariables(\"test_\", config)\n```\n\n### Read from JSON file\n\nConfig2 can read configuration from a JSON file as well, such as the one below.\n\n```JSON\n{\n  \"Host\": \"localhost\",\n  \"Port\": 9090,\n  \"Debug\": true\n}\n```\n\nUse the [ParseJson](https://pkg.go.dev/github.com/cinar/config2#ParseJson) function to parse the JSON file.\n\n```Golang\nerr := config2.ParseJson(\"test.json\", config)\nif err != nil {\n  log.Fatal(err)\n}\n```\n\n### Parse all\n\nConfig2 can parse the JSON file if it exists, parse the environment variables, and parse the command line arguments.\n\nUse the [ParseAll](https://pkg.go.dev/github.com/cinar/config2#ParseAll) function as shown below.\n\n```Golang\nconfig2.ParseAll(\"test.json\", \"test_\", config)\n```\n\n## License\n\nThe source code is provided under MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinar%2Fconfig2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcinar%2Fconfig2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcinar%2Fconfig2/lists"}