57 lines
1.6 KiB
Markdown
57 lines
1.6 KiB
Markdown
# Nyeki's API
|
|
|
|
This is a simple API I built for a few utilities I've found myself recoding over and over or using
|
|
across projects. The documentation can be found at https://api.nyeki.dev/ and at the root endpoint
|
|
if you're self-hosting.
|
|
|
|
This API provides no stability guarantees (unless you're self-hosting it and modify it). It's not
|
|
made for mass usage and with the small set of features it has, if you need something
|
|
production-ready you'll be better off writing something yourself.
|
|
|
|
## Self-hosting
|
|
|
|
This API is quite simple to self-host.
|
|
|
|
Env variables:
|
|
|
|
- `BIND`: The IP:PORT to bind the API to.
|
|
- `GITHUB_TOKEN`: A PAT token. You can get one [here](https://github.com/settings/tokens).
|
|
- `DISCORD_TOKEN`: A bot token. You can get one [here](https://discord.com/developers/applications/).
|
|
|
|
You can run it using raw Cargo by doing:
|
|
|
|
```sh
|
|
$ cargo run --release
|
|
```
|
|
|
|
The binary has a CLI interface for when you don't have environment variables nor an `.env` file,
|
|
you can get help for it with:
|
|
|
|
```sh
|
|
$ cargo run --release -- --help
|
|
```
|
|
|
|
CLI arguments go after the `--` in the cargo command.
|
|
|
|
To run deploy the API with Docker, just run:
|
|
|
|
```sh
|
|
$ docker run registry.nyeki.dev/nyeki/api:latest -p 8000:80 \
|
|
$ -e DISCORD_TOKEN="..." \
|
|
$ -e GITHUB_TOKEN="..."
|
|
```
|
|
|
|
You can also clone this repository and run:
|
|
|
|
```sh
|
|
$ docker build -t nyeki-api .
|
|
$ docker run nyeki-api -p 8000:80 \
|
|
$ -e DISCORD_TOKEN="..." \
|
|
$ -e GITHUB_TOKEN="..."
|
|
```
|
|
|
|
## Support
|
|
|
|
Enjoyed using this? Consider supporting this and other projects like this by
|
|
[making a donation here](https://ko-fi.com/nyeki). It really helps me keep this up and running!
|