{"id":22394083,"url":"https://github.com/flant/web-router","last_synced_at":"2025-06-23T03:35:51.369Z","repository":{"id":46084372,"uuid":"424143261","full_name":"flant/web-router","owner":"flant","description":"Go HTTP-server for software documentation websites. Adds the ability to have several documentation versions on the site: generates page partials for a menu, routes traffic, etc.","archived":false,"fork":false,"pushed_at":"2022-11-21T00:02:40.000Z","size":43,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-23T01:02:45.308Z","etag":null,"topics":[],"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/flant.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}},"created_at":"2021-11-03T08:23:37.000Z","updated_at":"2021-11-15T17:47:47.000Z","dependencies_parsed_at":"2022-09-03T06:51:38.366Z","dependency_job_id":null,"html_url":"https://github.com/flant/web-router","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fweb-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fweb-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fweb-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flant%2Fweb-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flant","download_url":"https://codeload.github.com/flant/web-router/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245749796,"owners_count":20666084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-05T05:08:54.774Z","updated_at":"2025-03-26T22:41:17.314Z","avatar_url":"https://github.com/flant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Version Router (v-router)\n\n**STAGE: Development**\n\nGo HTTP-server for software documentation websites. \n\nAdds the ability to have several documentation versions on the site: generates page partials for a menu, routes traffic, etc.\n\n## Channel names\n\nThe following channel names used (from less stable to more stable): Alpha, Beta, EarlyAccess, Stable, RockSolid.\n\nThe `VROUTER_USE_LATEST_CHANNEL` env adds  `latest` channel the the channels list.\n\n## Configuration\nweb-router uses the following environment variables:\n- `VROUTER_PATH_CHANNELS_FILE` — file in [appropriate format](#channels-file-format) containing information about versions and channels  \n- `VROUTER_PATH_STATIC` — path for static files to serve\n- `VROUTER_PATH_TPLS` — directory inside the `VROUTER_PATHSTATIC`, where templates resides. It is also a URL-location. Default — `/includes`. \n- `VROUTER_LOG_FORMAT` — Log format to use (json|text|color). Default — text.\n- `VROUTER_LOG_LEVEL` — Logging level (`info`, `debug`, `trace`)\n- `VROUTER_LISTEN_PORT` —  IP port to listen on (default - '8080')\n- `VROUTER_LISTEN_ADDRESS` — IP ddress to listen on (default - '0.0.0.0')\n- `VROUTER_LOCATION_VERSIONS` —  URL-location where versions will be accessed (default - `/documentation`).\n- `VROUTER_DEFAULT_GROUP` —  The default group name according to the used channel file. E.g. - \"v1\" or \"1\" (the leading 'v' can be ommited).\n- `VROUTER_DEFAULT_CHANNEL` —  The default channel name. E.g. - \"stable\".\n- `VROUTER_SHOW_LATEST_CHANNEL` —  Whether to show the 'latest' channel in the menu (default - `false`).\n- `VROUTER_URL_VALIDATION` — Whether to use URL checking before redirect (use false on test environments or protected with authentication).\n- `VROUTER_DOMAIN_MAP` — JSON structure to map language to domain. Example: '{\"en\" : \"global.company.com\", \"cn\" : \"company.cn\"}'\n- `VROUTER_I18N_TYPE` — Localization method. Can be `domain`, `location` or `separate-domain` (default - `location`).\n  - `location` - Versioned pages URL is like `/\u003cLANGUAGE\u003e\u003cVROUTER_LOCATIONVERSIONS\u003e/`. E.g `/en/documentation/`.\n  - `domain` - Versioned pages URL is like `\u003cLANGUAGE\u003e.somedomain/\u003cVROUTER_LOCATIONVERSIONS\u003e/`. E.g `ru.product.my/documentation/`.\n  - `separate-domain` - Use a separate domain for each language. Fill the `VROUTER_DOMAIN_MAP` value to use this mode.\n\n### Templates\n\nAll the templates should be placed in the `/includes`\n\n### Channels file format\n\nA file, containing information about which version is assigned to which channel, is the channel file. It can be YAML or JSON formatted.\n\nSpecify a path to the channels file in the `VROUTER_PATHCHANNELSFILE` environment variable. The default path to the channels file is 'channels.yaml' (relative to the directory where web-router starts).\n\nYAML Example:\n```yaml \ngroups:\n - name: \"1.1\"\n   channels:\n    - name: alpha\n      version: 1.1.23+fix50\n    - name: beta\n      version: 1.1.23+fix25\n    - name: ea\n      version: 1.1.22+fix40\n    - name: stable\n      version: 1.1.21+fix40\n    - name: rock-solid\n      version: 1.1.21\n - name: \"1.2\"\n   channels:\n    - name: alpha\n      version: 1.2.34 # Feature X was implemented\n    - name: beta\n      version: 1.2.33 # Feature Y was implemented\n    - name: ea\n      version: 1.2.27+fix3\n```\n\nJSON example:\n```json\n{\n  \"groups\": [\n    {\n      \"name\": \"1.1\",\n      \"channels\": [\n        {\n          \"name\": \"alpha\",\n          \"version\": \"1.1.23+fix50\"\n        },\n        {\n          \"name\": \"beta\",\n          \"version\": \"1.1.23+fix25\"\n        },\n        {\n          \"name\": \"ea\",\n          \"version\": \"1.1.22+fix40\"\n        },\n        {\n          \"name\": \"stable\",\n          \"version\": \"1.1.21+fix40\"\n        },\n        {\n          \"name\": \"rock-solid\",\n          \"version\": \"1.1.21\"\n        }\n      ]\n    },\n    {\n      \"name\": \"1.2\",\n      \"channels\": [\n        {\n          \"name\": \"alpha\",\n          \"version\": \"1.2.34\"\n        },\n        {\n          \"name\": \"beta\",\n          \"version\": \"1.2.33\"\n        },\n        {\n          \"name\": \"ea\",\n          \"version\": \"1.2.27+fix3\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n## Healthchecks, probes and status information\n\n- `/health` — normal response is JSON: `{\"status\": \"ok\"}`\n- `/status` — retrieves content of a [channel file](#channels-file-format) used\n\n## How to debug\n\nCompile:\n```\ngo build -gcflags \"all=-N -l\" -v -o server ./cmd/web-router\n```\n\nRun:\n```\ndlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./server\n```\n\nConnect to localhost:2345\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflant%2Fweb-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflant%2Fweb-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflant%2Fweb-router/lists"}