{"id":38253208,"url":"https://github.com/nkypy/gopa","last_synced_at":"2026-01-17T01:29:40.985Z","repository":{"id":59045132,"uuid":"526445810","full_name":"nkypy/gopa","owner":"nkypy","description":"open policy agent gin middleware for custom usage","archived":false,"fork":false,"pushed_at":"2022-12-13T07:46:21.000Z","size":180,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T23:03:58.767Z","etag":null,"topics":["gin","gin-gonic","middleware","opa","open-policy-agent"],"latest_commit_sha":null,"homepage":"","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/nkypy.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":"2022-08-19T03:07:11.000Z","updated_at":"2023-04-05T12:43:22.000Z","dependencies_parsed_at":"2023-01-28T09:05:11.456Z","dependency_job_id":null,"html_url":"https://github.com/nkypy/gopa","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/nkypy/gopa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkypy%2Fgopa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkypy%2Fgopa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkypy%2Fgopa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkypy%2Fgopa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nkypy","download_url":"https://codeload.github.com/nkypy/gopa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkypy%2Fgopa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28491530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T00:50:05.742Z","status":"ssl_error","status_checked_at":"2026-01-17T00:43:11.982Z","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":["gin","gin-gonic","middleware","opa","open-policy-agent"],"created_at":"2026-01-17T01:29:40.898Z","updated_at":"2026-01-17T01:29:40.973Z","avatar_url":"https://github.com/nkypy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gopa\n\n## 使用\n\n```go\n// 若要修改默认返回\n// 修改包内 ErrResponse\n//\n// src: rego 文件内容\n// data: yaml 文件内容\n// path: 数据库路径，若为空，则角色权限在配置文件\n// prefix: 路由前缀，写规则可以省略\nr := gin.Default()\nr.Use(gopa.Opa(src, data, \"opa.db\", \"/api/v1\"))\n```\n\n## 测试\n\n```bash\n# 新增测试可在 rego 文件中编辑\nopa test -v examples/policy.rego examples/policy.yaml\n```\n\n## 网页访问\n\n```bash\n# 允许\nhttp://127.0.0.1:8080/v1/orders/1?role=admin\n# 不允许\nhttp://127.0.0.1:8080/v1/users/1?role=admin\n# 允许\nhttp://127.0.0.1:8080/v1/users/1?role=super_admin\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkypy%2Fgopa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnkypy%2Fgopa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkypy%2Fgopa/lists"}