{"id":47079423,"url":"https://github.com/royge/ezcors","last_synced_at":"2026-03-12T06:52:18.500Z","repository":{"id":98079146,"uuid":"261082520","full_name":"royge/ezcors","owner":"royge","description":"Easy handling of CORS configuration file for rs.cors Options.","archived":false,"fork":false,"pushed_at":"2020-12-27T14:42:29.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-17T19:04:06.830Z","etag":null,"topics":["config","configuration","cors","go","golang"],"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/royge.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":"2020-05-04T04:45:19.000Z","updated_at":"2020-12-27T14:39:00.000Z","dependencies_parsed_at":"2023-05-23T11:30:15.601Z","dependency_job_id":null,"html_url":"https://github.com/royge/ezcors","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/royge/ezcors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royge%2Fezcors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royge%2Fezcors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royge%2Fezcors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royge%2Fezcors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/royge","download_url":"https://codeload.github.com/royge/ezcors/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/royge%2Fezcors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30417676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T06:40:58.731Z","status":"ssl_error","status_checked_at":"2026-03-12T06:40:40.296Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["config","configuration","cors","go","golang"],"created_at":"2026-03-12T06:52:18.423Z","updated_at":"2026-03-12T06:52:18.479Z","avatar_url":"https://github.com/royge.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ezcors\n\n[![Build Status](https://travis-ci.org/royge/ezcors.svg?branch=master)](https://travis-ci.org/royge/ezcors)\n[![Go Report Card](https://goreportcard.com/badge/github.com/royge/ezcors)](https://goreportcard.com/report/github.com/royge/ezcors)\n\nEasy handling of CORS configuration file for rs.cors Options.\n\n## How To Use\n\n```\ngo get github.com/royge/ezcors\n```\n\n### Example\n\nThe `cors.yml` file.\n\n```yaml\ndev:\n  allowedOrigins:\n    - http://127.0.0.1\n    - http://devhost.com\n  allowCredentials: false\n  allowedMethods:\n    - GET\n    - POST\n    - PUT\n    - PATCH\n    - DELETE\n  debug: true\ntest:\n  allowedOrigins:\n    - http://127.0.0.2\n    - http://testhost.com\n  allowCredentials: true\n  allowedMethods:\n    - POST\n  debug: true\nstage:\n  allowedOrigins:\n    - http://127.0.0.3\n    - http://stagehost.com\n  allowCredentials: true\n  allowedMethods:\n    - POST\n  debug: false\nprod:\n  allowedOrigins:\n    - http://127.0.0.4\n    - http://prodhost.com\n  allowCredentials: true\n  allowedMethods:\n    - POST\n  debug: false\n```\n\nUsage example:\n\n```go\nimport (\n\t\"fmt\"\n\n\t\"github.com/royge/ezcors\"\n)\n\n// ExampleNewConfig shows an example on how to read configuration from a yaml\n// file.\n// You can check the content of cors.yml file for reference.\nfunc ExampleNewConfig() {\n\t// Check for CORS config from cors.yml or config/cors.yml.\n\tconfig, err := ezcors.NewConfig()\n\tif err != nil {\n\t\tpanic(\"don't panic\")\n\t}\n\n\tfmt.Println(\"dev allowed origins:\", config[\"dev\"].AllowedOrigins)\n\tfmt.Println(\"dev allowed methods:\", config[\"dev\"].AllowedMethods)\n\tfmt.Println(\"dev allow credentials:\", config[\"dev\"].AllowCredentials)\n\tfmt.Println(\"dev debug:\", config[\"dev\"].Debug)\n\n\tfmt.Println(\"test allowed origins:\", config[\"test\"].AllowedOrigins)\n\tfmt.Println(\"test allowed methods:\", config[\"test\"].AllowedMethods)\n\tfmt.Println(\"test allow credentials:\", config[\"test\"].AllowCredentials)\n\tfmt.Println(\"test debug:\", config[\"test\"].Debug)\n\n\tfmt.Println(\"stage allowed origins:\", config[\"stage\"].AllowedOrigins)\n\tfmt.Println(\"prod allowed origins:\", config[\"prod\"].AllowedOrigins)\n\n\t// Check for CORS config from testdata/cors.yml.\n\tconfig, err = ezcors.NewConfig(ezcors.Option{\n\t\tPath: \"testdata/cors.yml\",\n\t})\n\tif err != nil {\n\t\tpanic(\"don't panic\")\n\t}\n\n\tfmt.Println(\"-----------\")\n\tfmt.Println(\"Custom Path\")\n\tfmt.Println(\"test allowed origins:\", config[\"test\"].AllowedOrigins)\n\tfmt.Println(\"stage allowed origins:\", config[\"stage\"].AllowedOrigins)\n\tfmt.Println(\"prod allowed origins:\", config[\"prod\"].AllowedOrigins)\n\n\t// Output:\n\t// dev allowed origins: [http://127.0.0.1 http://devhost.com]\n\t// dev allowed methods: [GET POST PUT PATCH DELETE]\n\t// dev allow credentials: false\n\t// dev debug: true\n\t// test allowed origins: [http://127.0.0.2 http://testhost.com]\n\t// test allowed methods: [POST]\n\t// test allow credentials: true\n\t// test debug: true\n\t// stage allowed origins: [http://127.0.0.3 http://stagehost.com]\n\t// prod allowed origins: [http://127.0.0.4 http://prodhost.com]\n\t// -----------\n\t// Custom Path\n\t// test allowed origins: [http://127.0.0.2 http://testhostcustom.com]\n\t// stage allowed origins: [http://127.0.0.3 http://stagehostcustom.com]\n\t// prod allowed origins: [http://127.0.0.4 http://prodhostcustom.com]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyge%2Fezcors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froyge%2Fezcors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froyge%2Fezcors/lists"}