fix: 🐛 Fix incorrect docs, make exit code 0 instead of 1

This commit is contained in:
Jesse Wierzbinski 2024-06-13 23:26:20 -10:00
parent 641e712272
commit edbe6e45b2
No known key found for this signature in database
6 changed files with 20 additions and 17 deletions

View file

@ -11,7 +11,7 @@ services:
command: "cli start --all-threads" command: "cli start --all-threads"
networks: networks:
- lysand-net - lysand-net
depends-on: depends_on:
- db - db
- redis - redis
- meilisearch - meilisearch

View file

@ -1,6 +1,6 @@
# Installation # Installation
### Requirements ## Requirements
- The [Bun Runtime](https://bun.sh), version 1.1.13 or later (usage of the latest version is recommended) - The [Bun Runtime](https://bun.sh), version 1.1.13 or later (usage of the latest version is recommended)
- Lysand will work on lower versions than 1.1.13, but only the latest version is supported - Lysand will work on lower versions than 1.1.13, but only the latest version is supported
@ -13,7 +13,7 @@
> >
> We will not be offering support to Windows or macOS users. If you are using one of these operating systems, please use a virtual machine or container to run Lysand. > We will not be offering support to Windows or macOS users. If you are using one of these operating systems, please use a virtual machine or container to run Lysand.
### With Docker/Podman ## With Docker/Podman
Docker is the recommended way to run Lysand (podman also works). To run Lysand with Docker, follow these steps: Docker is the recommended way to run Lysand (podman also works). To run Lysand with Docker, follow these steps:
@ -23,12 +23,12 @@ Docker is the recommended way to run Lysand (podman also works). To run Lysand w
curl -o docker-compose.yml https://raw.githubusercontent.com/lysand-org/lysand/main/docker-compose.yml curl -o docker-compose.yml https://raw.githubusercontent.com/lysand-org/lysand/main/docker-compose.yml
``` ```
2. Edit the `docker-compose.yml` file to set up the database connection and other settings 2. Edit the `docker-compose.yml` file to set up the database connection and other settings
3. Download the `config.toml.example` file from the repository 3. Download the `config.example.toml` file from the repository
```bash ```bash
curl -o config.toml.example https://raw.githubusercontent.com/lysand-org/lysand/main/config.toml.example curl -o config.example/toml https://raw.githubusercontent.com/lysand-org/lysand/main/config/config.example.toml
``` ```
4. Edit the `config.toml.example` file to set up the database connection and other settings, then place it inside `config/` (create the `config/` directory if it does not exist) 4. Edit the `config.example.toml` file to set up the database connection and other settings, rename it to `config.toml`, then place it inside `config/` (create the `config/` directory if it does not exist)
5. Run the following command to start the server: 5. Run the following command to start the server:
```bash ```bash
@ -37,7 +37,7 @@ docker-compose up
You may need root privileges to run Docker commands. You may need root privileges to run Docker commands.
### From Source ## From Source
1. Clone this repository 1. Clone this repository
@ -68,7 +68,7 @@ bun prod-build
You may now start the server with `bun start`. It lives in the `dist/` directory, all the other code can be removed from this point onwards. You may now start the server with `bun start`. It lives in the `dist/` directory, all the other code can be removed from this point onwards.
### Running the Server ## Running the Server
Database migrations are run automatically on startup. Database migrations are run automatically on startup.
@ -81,7 +81,7 @@ Please see the [CLI documentation](cli.md) for more information on how to use th
> >
> This is possible by following the instructions in [this file](glitch-soc.md). > This is possible by following the instructions in [this file](glitch-soc.md).
### Updating the server ## Updating the server
Updating the server is as simple as pulling the latest changes from the repository and running `bun prod-build` again. You may need to run `bun install` again if there are new dependencies. Updating the server is as simple as pulling the latest changes from the repository and running `bun prod-build` again. You may need to run `bun install` again if there are new dependencies.

View file

@ -34,7 +34,7 @@ export const setupDatabase = async (
"Database", "Database",
"Failed to connect to database. Please check your configuration.", "Failed to connect to database. Please check your configuration.",
); );
process.exit(1); process.exit();
} }
// Migrate the database // Migrate the database
@ -52,7 +52,7 @@ export const setupDatabase = async (
"Database", "Database",
"Failed to migrate database. Please check your configuration.", "Failed to migrate database. Please check your configuration.",
); );
process.exit(1); process.exit();
} }
info && (await logger.log(LogLevel.Info, "Database", "Database migrated")); info && (await logger.log(LogLevel.Info, "Database", "Database migrated"));

View file

@ -73,7 +73,7 @@ if (isEntry) {
"Server", "Server",
chalk.gray(`${privateKey};${publicKey}`), chalk.gray(`${privateKey};${publicKey}`),
); );
process.exit(1); process.exit();
} }
// Try and import the key // Try and import the key
@ -104,7 +104,7 @@ if (isEntry) {
"Server", "Server",
"The JWT key could not be imported! You may generate a new one by removing the old one from the config and restarting the server (this will invalidate all current JWTs).", "The JWT key could not be imported! You may generate a new one by removing the old one from the config and restarting the server (this will invalidate all current JWTs).",
); );
process.exit(1); process.exit();
} }
if ( if (
@ -142,7 +142,7 @@ if (isEntry) {
`Generated key: ${chalk.gray(base64)}`, `Generated key: ${chalk.gray(base64)}`,
); );
process.exit(1); process.exit();
} }
} }
@ -245,7 +245,7 @@ if (config.frontend.enabled) {
"Server", "Server",
`Frontend URL is not a valid URL: ${config.frontend.url}`, `Frontend URL is not a valid URL: ${config.frontend.url}`,
); );
process.exit(1); process.exit();
} }
// Check if frontend is reachable // Check if frontend is reachable

View file

@ -6,6 +6,7 @@
*/ */
import { loadConfig, watchConfig } from "c12"; import { loadConfig, watchConfig } from "c12";
import { fromZodError } from "zod-validation-error";
import { type Config, configValidator } from "./config.type"; import { type Config, configValidator } from "./config.type";
const { config } = await watchConfig({ const { config } = await watchConfig({
@ -21,7 +22,9 @@ const { config } = await watchConfig({
const parsed = await configValidator.safeParseAsync(config); const parsed = await configValidator.safeParseAsync(config);
if (!parsed.success) { if (!parsed.success) {
process.exit(1); console.error("Invalid config file:");
console.error(fromZodError(parsed.error).message);
process.exit();
} }
const exportedConfig = parsed.data; const exportedConfig = parsed.data;

View file

@ -44,7 +44,7 @@ export const connectMeili = async (logger: MultiLogManager | LogManager) => {
"Meilisearch", "Meilisearch",
"Error while connecting to Meilisearch", "Error while connecting to Meilisearch",
); );
process.exit(1); process.exit();
} }
}; };