{"id":17436108,"url":"https://github.com/jnsgruk/gosherve","last_synced_at":"2025-04-16T03:36:41.208Z","repository":{"id":64056283,"uuid":"320066953","full_name":"jnsgruk/gosherve","owner":"jnsgruk","description":"A simple HTTP file server with some basic URL shortening/redirect functionality","archived":false,"fork":false,"pushed_at":"2025-02-13T16:05:41.000Z","size":96,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-23T19:37:41.339Z","etag":null,"topics":["golang","http-server","redirect","shortener","website"],"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/jnsgruk.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-12-09T20:06:39.000Z","updated_at":"2025-02-13T16:05:45.000Z","dependencies_parsed_at":"2024-05-13T07:28:20.040Z","dependency_job_id":"d19b25c3-1e3b-418d-91de-8ae29dfc6521","html_url":"https://github.com/jnsgruk/gosherve","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnsgruk%2Fgosherve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnsgruk%2Fgosherve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnsgruk%2Fgosherve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jnsgruk%2Fgosherve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jnsgruk","download_url":"https://codeload.github.com/jnsgruk/gosherve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241341367,"owners_count":19947097,"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":["golang","http-server","redirect","shortener","website"],"created_at":"2024-10-17T10:02:53.892Z","updated_at":"2025-03-01T08:32:43.624Z","avatar_url":"https://github.com/jnsgruk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gosherve\n\n\u003e A simple HTTP file server with some basic URL shortening/redirect functionality\n\nThis project is a simple web server written in Go that will:\n\n- Serve files from a specified directory\n- Serve redirects specified in a file hosted at a URL\n- Report some metrics about the redirects served\n\nI wrote this to satisfy the use case of hosting my very simple [personal website](https://jnsgr.uk), while also giving me the ability to set up custom short URLs relatively easily. I don't need any tracking, stats or clever features...\n\nI host the \"redirects file\" in a Github Gist; it looks something like this:\n\n```\ngithub https://github.com/jnsgruk\nlinkedin https://linkedin.com/in/jnsgruk\nsomething https://somelink.com\nwow https://www.ohmygoodness.com\n```\n\nWith this simple config, visiting [https://jnsgr.uk/linkedin](https://jnsgr.uk/linkedin) returns a `302` that redirects you to my LinkedIn page, etc. If an unknown URL is requested, the server first refreshes its list of redirects from the specified URL, and then either returns the redirect or a 404. There is some **very basic** parsing done on the redirects file to ensure entries are valid.\n\nIf file serving is enabled, the web server will always try to find a matching file before checking for a redirect.\n\n## Configuration\n\nThe server is configured with two environment variables:\n\n| Variable Name               |   Type   | Notes                                                                                           |\n| :-------------------------- | :------: | :---------------------------------------------------------------------------------------------- |\n| `GOSHERVE_WEBROOT`          | `string` | Path to directory from which to serve files. If not specified, file serving is simply disabled. |\n| `GOSHERVE_REDIRECT_MAP_URL` | `string` | URL containing a list of aliases and corresponding redirect URLs                                |\n| `GOSHERVE_LOG_LEVEL`        | `string` | Sets the log level. One of: `info`, `debug`, `warn`, `error`                                    |\n\n## Hacking\n\nThe application has minimal dependencies and can be run like so:\n\n```bash\ngit clone https://github.com/jnsgruk/gosherve\n\n# Export some variables to configure gosherve\nexport GOSHERVE_REDIRECT_MAP_URL=\"https://gist.githubusercontent.com/someuser/somegisthash/raw\"\nexport GOSHERVE_WEBROOT=\"/path/to/some/files\"\n\n# Run it!\ngo run ./cmd/gosherve/main.go\n```\n\n## Build \u0026 Release\n\nThis project uses goreleaser to manage builds and releases.\n\nIn local development, you can build a snapshot release like so:\n\n```shell\ngoreleaser --snapshot --rm-dist\n```\n\nThe output will be present in `dist/`.\n\nTo create a release, create a new tag and push to Github, the release will be automatically\ncreated by Goreleaser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnsgruk%2Fgosherve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjnsgruk%2Fgosherve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjnsgruk%2Fgosherve/lists"}