From dcd3930be56c4c2adc628236e025398d0a4d60aa Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Mon, 11 Mar 2024 11:25:00 -0400 Subject: [PATCH] Update README.md, add .env.template --- .env.template | 8 ++++++++ README.md | 33 +++++++++++++++++++++++++++++---- src/api/index.ts | 5 +++-- 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..90df219 --- /dev/null +++ b/.env.template @@ -0,0 +1,8 @@ +DATABASE_URL="postgresql://" +MPP_TOKEN_NET="" +MPP_FISHING_TOKEN= + +DISCORD_TOKEN= +DISCORD_FISHING_TOKEN= + +CLI_FISHING_TOKEN= diff --git a/README.md b/README.md index ffc836d..db7ae29 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,35 @@ This project was created using `bun init` in bun v1.0.25. [Bun](https://bun.sh) ## Deployment -Setup the `.env` file like other projects, then: +Firstly, a PostgreSQL database must be ready beforehand to connect to with a URI. This shoud be self-explanatory to setup. + +Copy the default `.env` file: ```bash -bunx prisma db push -bun install -bun run src/index.ts +cp .env.template .env +``` + +Edit that file to match your environment, then install packages: + +```bash +bun install +bunx prisma db push +``` + +Run both the http server and the clients for various services separately with these commands: + +```bash +bun . # Main http server +``` + +```bash +bun src/mpp/index.ts # MPP bot +``` + +```bash +bun src/discord/index.ts # Discord bot +``` + +```bash +bun src/cli/index.ts # Command-line client (for debugging) ``` diff --git a/src/api/index.ts b/src/api/index.ts index d56e418..83172a4 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,3 @@ -import "./api/server"; -import "./cli/readline"; import { startFisherTick } from "./fish/fishers"; import { startObjectTimers } from "./fish/locations"; import { initTree } from "./fish/tree"; @@ -9,3 +7,6 @@ startObjectTimers(); await startFisherTick(); await initTree(); loadDefaultBehaviors(); + +require("./api/server"); +require("./cli/readline");