docs.brut.systems/docs/index.riv
2026-01-28 20:12:42 -07:00

49 lines
1.6 KiB
Text

DOCS.BRUT.SYSTEMS
This program acts as a proxy to serve files directly from repositories.
It expects the following environment variables to be set:
- `API_URL` - Base Forgejo API url (ex. `https://git.brut.systems`)
- `API_TOKEN` - Forgejo API authorization token
- `REDIRECT_URL` - Redirect url when access fails or files do not exist (ex. `https://git.brut.systems`)
- `PORT` - Port to listen on
HOW IT WORKS
When a request like `http://:PORT/user/repository/path/to/file` is sent to the proxy, it will dynamically fetch that file from the repository and return it to the user.
USAGE WITH SYSTEMD
Create a file at `/etc/systemd/system/docs.brut.service` with the following:
[Unit]
Description=Serves files from Git repositories
After=network.target
[Service]
Type=simple
ExecStart=<path/to/respository>/start.sh
WorkingDirectory=<path/to/repository>
ExecStop=/usr/bin/pkill docs.brut.systems
Restart=always
User=<user to run as>
Environment="API_URL=<url>"
Environment="API_TOKEN=<token>"
Environment="REDIRECT_URL=<url>"
Environment="PORT=<port>"
[Install]
WantedBy=multi-user.target
Then start the service:
sudo systemctl enable docs.brut
sudo systemctl start docs.brut
USAGE WITHIN GIT.BRUT.SYSTEMS
Those with repositories on [https://git.brut.systems git.brut.systems] can serve websites by creating a `docs/` folder (on the default branch). While any file from the repository can be accessed, files within `docs/` are accessible from `/`. If a [/main.go file] within `docs/` conflicts with another file in the repository, the file in `docs/` take precedence.