iratusmachina 5535fdd164 | ||
---|---|---|
sample | ||
templates | ||
testData | ||
.gitignore | ||
Dockerfile | ||
Makefile | ||
README.md | ||
app.go | ||
bytesize.go | ||
bytesize_test.go | ||
conf.go | ||
conf_test.go | ||
embed.go | ||
go.mod | ||
go.sum | ||
handlers.go | ||
handlers_test.go | ||
logger.go | ||
logger_test.go | ||
main.go | ||
middleware.go | ||
testUtils_test.go |
README.md
GocustomUrls
This is a homespun implementation of the practice of using custom import paths for go modules.
This package basically returns a html document with a prefilled meta tag
<meta name="go-import" content="{package} git {url location of the package}">
There are ways to do this with nginx or hugo but I wanted to:
- host on a subdomain
- not muck up my ngnix config
So I used golang for this project.
Running
$ ./artifacts/gocustomurls --conf <PATH_TO_CONF_FILE>
A sample config file is located here and a sample rules file is located here
SystemD
A sample systemd file is located here. You should run this set of commands from here
Docker
A sample Dockefile for use with systemd is here. You should run this set of commands from here.
If you do not want to use systemd, you can run this instead:
$ HOME=${PWD} docker build -t appimage/gocustomurls --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg USERNAME=$(whoami) --build-arg PORT=7070 --no-cache --progress=plain .
$
Testing
You can test with
(a) httpie
$ http --body "https://{domain.name}/{package}?go-get=1"
...Truncated output
(b) With the go-get command
$ 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)
TODOs
- Fix permission errors around opening the app.log and rules.json.
- Make the flags (config, rules) required instead of optional.
Figure how to use logrotate (a linux utility)- Figure how to do log rotation as part of this app's function
- Add tests
- Add systemd.service and explanation
- Add Dockerfile and explanation
- Add mirror to Github
- Add Github action
- Figure how to use
goreleaser
here to release deb and rpm packages (so basically split it, goreleaser for github and woodpecker for Woodpecker) - Update README.md