From 4d33ea7139f022f1ea12ae107ad1eaa8314ca1a6 Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Fri, 7 Apr 2023 12:00:09 +0100 Subject: [PATCH 1/2] add instructions --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index faf9ecb..190a433 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ # Backend Vencord API + +## Hosting +The API has a Docker Compose configuration, so software-wise you shouldn't need much more than just Docker. +Docker is the official way of hosting the backend, and other setups (whilst technically supported) will be +up to you to manage. + +1. Clone the repository +2. Copy `.env.example` to `.env` +3. Configure as necessary + - Port and host are irrelevant since it's running in a container, but you can change them if you wish. + - `REDIS_URI` should be changed to `redis:6379`. + - `ROOT_REDIRECT` should be changed to whatever you want the `/` of the API to be set to a different site, + like your own personal homepage. + - `DISCORD_*` should be configured with your Discord application. + - `PEPPER_*` should be unique values. These provide extra anonymity and make it more difficult to get user + info. + - `SIZE_LIMIT` is up to you, but should usually be left as default. This is for the settings sync and how + much data a user can store. +4. Create a `docker-compose.override.yml` that maps your ports, like so: + ```yaml + services: + backend: + ports: + - HOST_PORT:8080 + ``` +5. `docker compose up -d` +6. Configure a reverse proxy to serve the backend as `/v1/` on whatever domain you please. From a51be4a111d12e8f56594e8566aeb2da31ea1124 Mon Sep 17 00:00:00 2001 From: Matt Artist Date: Fri, 7 Apr 2023 12:18:29 -0400 Subject: [PATCH 2/2] Handle unexpected redis error on setup (#2) Co-authored-by: Lewis Crichton --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 873d35f..a22d95e 100644 --- a/main.go +++ b/main.go @@ -282,6 +282,8 @@ func main() { secret = hex.EncodeToString(key) rdb.Set(c.Context(), "secrets:"+hash(PEPPER_SECRETS+userId), secret, 0) + } else if err != nil { + panic(err) } return c.JSON(&fiber.Map{