{"id":13410923,"url":"https://github.com/kkyr/fig","last_synced_at":"2026-02-15T02:01:19.721Z","repository":{"id":37337724,"uuid":"234387532","full_name":"kkyr/fig","owner":"kkyr","description":"A minimalist Go configuration library","archived":false,"fork":false,"pushed_at":"2025-06-03T21:18:44.000Z","size":263,"stargazers_count":381,"open_issues_count":5,"forks_count":32,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-15T02:29:35.832Z","etag":null,"topics":["config-file","configuration","configuration-management","environment","environment-variables","go","golang","json","toml","yaml"],"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/kkyr.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,"zenodo":null}},"created_at":"2020-01-16T18:43:19.000Z","updated_at":"2025-08-13T21:54:04.000Z","dependencies_parsed_at":"2023-02-18T11:17:48.362Z","dependency_job_id":"bbf3e955-f9c7-4a70-b763-0749a1592739","html_url":"https://github.com/kkyr/fig","commit_stats":{"total_commits":67,"total_committers":7,"mean_commits":9.571428571428571,"dds":"0.19402985074626866","last_synced_commit":"0afa4d5b6cf143c2e1326a6fa9bfe5162e47db6f"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/kkyr/fig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkyr%2Ffig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkyr%2Ffig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkyr%2Ffig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkyr%2Ffig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkyr","download_url":"https://codeload.github.com/kkyr/fig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkyr%2Ffig/sbom","scorecard":{"id":562954,"data":{"date":"2025-08-11","repo":{"name":"github.com/kkyr/fig","commit":"650a93045ae6a6ac1ad1d9bf57eecd848c3e73c4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":2,"reason":"Found 8/29 approved changesets -- score normalized to 2","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":"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":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint-and-test.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-and-test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/kkyr/fig/lint-and-test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-and-test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/kkyr/fig/lint-and-test.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: build/lint.sh:9","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"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":"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:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE: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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T14:11:36.826Z","repository_id":37337724,"created_at":"2025-08-20T14:11:36.826Z","updated_at":"2025-08-20T14:11:36.826Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29465397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T01:01:38.065Z","status":"online","status_checked_at":"2026-02-15T02:00:07.449Z","response_time":118,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config-file","configuration","configuration-management","environment","environment-variables","go","golang","json","toml","yaml"],"created_at":"2024-07-30T20:01:10.231Z","updated_at":"2026-02-15T02:01:19.607Z","avatar_url":"https://github.com/kkyr.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"img/fig.logo.png\" alt=\"fig\" title=\"fig\" class=\"img-responsive\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/kkyr/fig?tab=doc\"\u003e\u003cimg src=\"https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\" alt=\"godoc\" title=\"godoc\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/kkyr/fig/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/tag/kkyr/fig\" alt=\"semver tag\" title=\"semver tag\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/kkyr/fig\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/kkyr/fig\" alt=\"go report card\" title=\"go report card\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/kkyr/fig?branch=master\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/kkyr/fig/badge.svg?branch=master\" alt=\"coverage status\" title=\"coverage status\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/kkyr/fig/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/kkyr/fig\" alt=\"license\" title=\"license\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# fig\n\nfig is a tiny library for loading an application's configuration into a Go struct.\n\n## Why fig?\n\n- 🛠️ Define your **configuration**, **validations** and **defaults** all within a single struct.\n- 🌍 Easily load your configuration from a **file**, the **environment**, or both.\n- ⏰ Decode strings into `Time`, `Duration`, `Regexp`, or any custom type that satisfies the `StringUnmarshaler` interface.\n- 🗂️ Compatible with `yaml`, `json`, and `toml` file formats.\n- 🧩 Only three external dependencies.\n\n## Getting Started\n\n`$ go get -d github.com/kkyr/fig`\n\nDefine your config file:\n\n```yaml\n# config.yaml\n\nbuild: \"2020-01-09T12:30:00Z\"\n\nserver:\n    ports:\n      - 8080\n    cleanup: 1h\n\nlogger:\n    level: \"warn\"\n    trace: true\n```\n\nDefine your struct along with _validations_ or _defaults_:\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n\n  \"github.com/kkyr/fig\"\n)\n\ntype Config struct {\n  Build  time.Time `fig:\"build\" validate:\"required\"`\n  Server struct {\n    Host    string        `fig:\"host\" default:\"127.0.0.1\"`\n    Ports   []int         `fig:\"ports\" default:\"[80,443]\"`\n    Cleanup time.Duration `fig:\"cleanup\" default:\"30m\"`\n  }\n  Logger struct {\n    Level   string         `fig:\"level\" default:\"info\"`\n    Pattern *regexp.Regexp `fig:\"pattern\" default:\".*\"`\n    Trace   bool           `fig:\"trace\"`\n  }\n}\n\nfunc main() {\n  var cfg Config\n  err := fig.Load(\u0026cfg)\n  // error handling omitted\n  \n  fmt.Printf(\"%+v\\n\", cfg)\n  // {Build:2019-12-25T00:00:00Z Server:{Host:127.0.0.1 Ports:[8080] Cleanup:1h0m0s} Logger:{Level:warn Pattern:.* Trace:true}}\n}\n```\n\nFields marked as _required_ are checked to ensure they're not empty, and _default_ values are applied to fill in those that are empty.\n\n## Environment\n\nBy default, fig will only look for values in a config file. To also include values from the environment, use the `UseEnv` option:\n\n```go\nfig.Load(\u0026cfg, fig.UseEnv(\"APP_PREFIX\"))\n```\n\nIn case of conflicts, values from the environment take precedence.\n\n## Usage\n\nSee usage [examples](/examples).\n\n## Documentation\n\nFor detailed documentation, visit [go.dev](https://pkg.go.dev/github.com/kkyr/fig?tab=doc).\n\n## Contributing\n\nPRs are welcome! Please explain your motivation for the change in your PR and ensure your change is properly tested and documented.\n","funding_links":[],"categories":["开源类库","Configuration","Open source library","Go","配置","配置管理","配置管理 `配置解析库`","Uncategorized"],"sub_categories":["配置","Standard CLI","Construction","Advanced Console UIs","标准CLI","标准 CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkyr%2Ffig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkyr%2Ffig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkyr%2Ffig/lists"}