47 lines
1.6 KiB
Markdown
47 lines
1.6 KiB
Markdown
# pack
|
|
|
|
Pack is web server written in [rust](https://www.rust-lang.org/) with
|
|
[axum](https://docs.rs/axum/latest/axum/) for hosting built packages as a
|
|
destination endpoint for packages in a continuous integration workflow. It is
|
|
designed around Gitea, using it for its authentication as well as integrating
|
|
with Gitea actions.
|
|
|
|
## Setup
|
|
To setup the server, rename `pack.yml.template` to `pack.yml` and fill in the details
|
|
for your configuration. Place the built executable in a folder with properly configured
|
|
permissions, and make sure the upload path has permissions `750`. Indeed, all
|
|
subdirectories are created with this permissions, and all files are created with
|
|
`640`.
|
|
|
|
|
|
## API
|
|
The only API endpoint intended to be exposed is `/api/files/{owner}/{repo}/{*path}`, which
|
|
supports `GET` and `DELETE`. Every request requires an Bearer Authorization token,
|
|
which should be exactly the Gitea OAuth2 token. This API is intended for scripted management of uploaded
|
|
packages in the contiguous integration (CI) chain. For instance, automatically pulling
|
|
latest versions into a production environment.
|
|
|
|
### GET
|
|
In the case, of GET, a JSON of the entries in a directory is returned. The format
|
|
is shown below.
|
|
|
|
```json
|
|
{
|
|
"entries": [
|
|
{
|
|
name: "...",
|
|
name_uri: "...",
|
|
icon: "...",
|
|
size: "...",
|
|
},
|
|
...
|
|
]
|
|
```
|
|
|
|
If the requested path is a file, it will redirect to download the file. If using `curl`,
|
|
make sure the `-L` flag is enabled to follow redirects.
|
|
|
|
### DELETE
|
|
This will delete the file at the destination, or delete the *entire* directory.
|
|
Use with caution.
|