fix(build): 🐛 Changed the CI test config so it is valid

This commit is contained in:
Jesse Wierzbinski 2024-05-15 16:50:07 -10:00
parent fb31375b74
commit 023b80f411
No known key found for this signature in database
3 changed files with 51 additions and 43 deletions

View file

@ -44,7 +44,7 @@ jwt_key = "MC4CAQAwBQYDK2VwBCIEID+H5n9PY3zVKZQcq4jrnE1IiRd2EWWr8ApuHUXmuOzl;MCow
[http] [http]
base_url = "http://0.0.0.0:8080" base_url = "http://0.0.0.0:8080"
bind = "0.0.0.0" bind = "0.0.0.0"
bind_port = "8080" bind_port = 8080
# Bans IPv4 or IPv6 IPs (wildcards, networks and ranges are supported) # Bans IPv4 or IPv6 IPs (wildcards, networks and ranges are supported)
banned_ips = [] banned_ips = []
@ -75,23 +75,12 @@ convert_to = "webp"
[s3] [s3]
# Can be left blank if you don't use the S3 media backend # Can be left blank if you don't use the S3 media backend
endpoint = "https://s3-us-west-2.amazonaws.com" # endpoint = "https://s3-us-west-2.amazonaws.com"
access_key = "" # access_key = ""
secret_access_key = "" # secret_access_key = ""
region = "us-west-2" # region = "us-west-2"
bucket_name = "lysand" # bucket_name = "lysand"
public_url = "https://cdn.example.com" # public_url = "https://cdn.example.com"
[email]
# Sends an email to moderators when a report is received
# NOT IMPLEMENTED
send_on_report = false
# Sends an email to moderators when a user is suspended
# NOT IMPLEMENTED
send_on_suspend = false
# Sends an email to moderators when a user is unsuspended
# NOT IMPLEMENTED
send_on_unsuspend = false
[validation] [validation]
# Self explanatory # Self explanatory
@ -200,9 +189,9 @@ visibility = "public"
# Default language for new notes # Default language for new notes
language = "en" language = "en"
# Default avatar, must be a valid URL or "" # Default avatar, must be a valid URL or ""
avatar = "" # avatar = ""
# Default header, must be a valid URL or "" # Default header, must be a valid URL or ""
header = "" # header = ""
[activitypub] [activitypub]
# Use ActivityPub Tombstones instead of deleting objects # Use ActivityPub Tombstones instead of deleting objects
@ -241,9 +230,9 @@ authorized_fetch = false
name = "Lysand" name = "Lysand"
description = "A test instance of Lysand" description = "A test instance of Lysand"
# URL to your instance logo (jpg files should be renamed to jpeg) # URL to your instance logo (jpg files should be renamed to jpeg)
logo = "" # logo = ""
# URL to your instance banner (jpg files should be renamed to jpeg) # URL to your instance banner (jpg files should be renamed to jpeg)
banner = "" # banner = ""
[filters] [filters]

View file

@ -1,5 +1,5 @@
import { z } from "zod";
import { types as mimeTypes } from "mime-types"; import { types as mimeTypes } from "mime-types";
import { z } from "zod";
export enum MediaBackendType { export enum MediaBackendType {
LOCAL = "local", LOCAL = "local",
@ -69,7 +69,7 @@ export const configValidator = z.object({
.min(1) .min(1)
.max(2 ** 16 - 1) .max(2 ** 16 - 1)
.default(7700), .default(7700),
api_key: z.string().min(1), api_key: z.string(),
enabled: z.boolean().default(false), enabled: z.boolean().default(false),
}), }),
signups: z.object({ signups: z.object({
@ -104,19 +104,34 @@ export const configValidator = z.object({
// Not using .ip() because we allow CIDR ranges and wildcards and such // Not using .ip() because we allow CIDR ranges and wildcards and such
banned_ips: z.array(z.string()).default([]), banned_ips: z.array(z.string()).default([]),
banned_user_agents: z.array(z.string()).default([]), banned_user_agents: z.array(z.string()).default([]),
tls: z.object({ tls: z
enabled: z.boolean().default(false), .object({
key: z.string(), enabled: z.boolean().default(false),
cert: z.string(), key: z.string(),
passphrase: z.string().optional(), cert: z.string(),
ca: z.string().optional(), passphrase: z.string().optional(),
}), ca: z.string().optional(),
bait: z.object({ })
enabled: z.boolean().default(false), .default({
send_file: z.string().optional(), enabled: false,
bait_ips: z.array(z.string()).default([]), key: "",
bait_user_agents: z.array(z.string()).default([]), cert: "",
}), passphrase: "",
ca: "",
}),
bait: z
.object({
enabled: z.boolean().default(false),
send_file: z.string().optional(),
bait_ips: z.array(z.string()).default([]),
bait_user_agents: z.array(z.string()).default([]),
})
.default({
enabled: false,
send_file: "",
bait_ips: [],
bait_user_agents: [],
}),
}), }),
frontend: z frontend: z
.object({ .object({
@ -425,9 +440,13 @@ export const configValidator = z.object({
.default("info"), .default("info"),
log_ip: z.boolean().default(false), log_ip: z.boolean().default(false),
log_filters: z.boolean().default(true), log_filters: z.boolean().default(true),
storage: z.object({ storage: z
requests: z.string().default("logs/requests.log"), .object({
}), requests: z.string().default("logs/requests.log"),
})
.default({
requests: "logs/requests.log",
}),
}) })
.default({ .default({
log_requests: false, log_requests: false,

View file

@ -5,10 +5,10 @@
* Fuses both and provides a way to retrieve individual values * Fuses both and provides a way to retrieve individual values
*/ */
import { watchConfig, loadConfig } from "c12"; import { loadConfig, watchConfig } from "c12";
import { configValidator, type Config } from "./config.type";
import { fromError } from "zod-validation-error";
import chalk from "chalk"; import chalk from "chalk";
import { fromError } from "zod-validation-error";
import { type Config, configValidator } from "./config.type";
const { config } = await watchConfig({ const { config } = await watchConfig({
configFile: "./config/config.toml", configFile: "./config/config.toml",