gocustomurls/README.md

57 lines
1.7 KiB
Markdown
Raw Normal View History

2024-05-28 23:30:59 +00:00
# GocustomUrls
2024-05-06 07:20:13 +00:00
2024-05-28 23:30:59 +00:00
This is a homespun implementation of the practice of [using custom import paths for go modules](https://pkg.go.dev/cmd/go#hdr-Remote_import_paths).
This package basically returns a html document with a prefilled meta tag
```html
<meta name="go-import" content="{package} git {url location of the package}">
```
There are ways to do this with [nginx](https://www.nirenjan.com/2019/golang-vanity-urls-in-nginx/) or [hugo](https://blog.jbowen.dev/2020/07/using-go-vanity-urls-with-hugo/) but I wanted to:
* host on a subdomain
* not muck up my ngnix config
So I used golang for this project.
## Running
```sh
$ ./artifacts/gocustomurls --conf <PATH_TO_CONF_FILE>
```
A sample config file is located [here](./sample/config.json)
## SystemD
A sample systemd file is located [here](./sample/gocustomurls.service)
2024-05-28 23:30:59 +00:00
## Testing
You can test with
(a) [httpie](https://httpie.io/)
```sh
$ http --body "https://{domain.name}/{package}?go-get=1"
...Truncated output
2024-05-28 23:30:59 +00:00
```
(b) With the go-get command
2024-05-06 07:20:13 +00:00
```sh
$ go get -v -u jbowen.dev/cereal
get "jbowen.dev/cereal": found meta tag get.metaImport{Prefix:"jbowen.dev/cereal", VCS:"git", RepoRoot:"https://github.com/jamesbo13/cereal"} at //jbowen.dev/cereal?go-get=1
jbowen.dev/cereal (download)
```
2024-05-28 23:30:59 +00:00
## TODOs
2024-05-06 07:20:13 +00:00
2024-05-28 23:30:59 +00:00
* [x] Fix permission errors around opening the app.log and rules.json.
* [x] Make the flags (config, rules) required instead of optional.
2024-06-19 20:16:13 +00:00
~~* [ ] Figure how to use logrotate (a linux utility)~~
* [x] Figure how to do log rotation as part of this app's function
* [x] Add tests
* [ ] Figure how to use `goreleaser` [here](https://nfpm.goreleaser.com/) to release deb and rpm packages (so basically split it, goreleaser for github and woodpecker for Woodpecker)
* [ ] Update README.md