55 lines
1.8 KiB
Markdown
55 lines
1.8 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:
|
|
|
|
- `NYEKI_DEBUG`: Whether to start in debug mode.
|
|
- `NYEKI_REDIS_URL`: The Redis URL to use for caching.
|
|
- `NYEKI_GITHUB_TOKEN`: A PAT token. You can get one
|
|
[here](https://github.com/settings/tokens).
|
|
- `NYEKI_DISCORD_TOKEN`: A bot token. You can get one
|
|
[here](https://discord.com/developers/applications/).
|
|
- `NYEKI_BIND_HOST`: Docker-only. The IP to bind the API to. Defaults to `0.0.0.0`.
|
|
- `NYEKI_BIND_PORT`: Docker-only. The port to bind the API to. Defaults to `8000`.
|
|
- `NYEKI_WORKERS`: Docker-only. The amount of async web workers to spawn. Defaults to
|
|
`$(nproc)` (the amount of CPU cores).
|
|
|
|
You can run it using uv by doing:
|
|
|
|
```sh
|
|
$ uv run uvicorn nyekiapi:app
|
|
```
|
|
|
|
To run deploy the API with Docker, just run:
|
|
|
|
```sh
|
|
$ docker run git.moan.dev/nyeki/nyeki-api:v2.0.0 -p 8000:80 \
|
|
$ -e NYEKI_DISCORD_TOKEN="..." \
|
|
$ -e NYEKI_GITHUB_TOKEN="..."
|
|
```
|
|
|
|
You can also clone this repository and run:
|
|
|
|
```sh
|
|
$ docker build -t nyeki-api .
|
|
$ docker run nyeki-api -p 8000:80 \
|
|
$ -e NYEKI_DISCORD_TOKEN="..." \
|
|
$ -e NYEKI_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!
|