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]
base_url = "http://0.0.0.0:8080"
bind = "0.0.0.0"
bind_port = "8080"
bind_port = 8080
# Bans IPv4 or IPv6 IPs (wildcards, networks and ranges are supported)
banned_ips = []
@ -75,23 +75,12 @@ convert_to = "webp"
[s3]
# Can be left blank if you don't use the S3 media backend
endpoint = "https://s3-us-west-2.amazonaws.com"
access_key = ""
secret_access_key = ""
region = "us-west-2"
bucket_name = "lysand"
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
# endpoint = "https://s3-us-west-2.amazonaws.com"
# access_key = ""
# secret_access_key = ""
# region = "us-west-2"
# bucket_name = "lysand"
# public_url = "https://cdn.example.com"
[validation]
# Self explanatory
@ -200,9 +189,9 @@ visibility = "public"
# Default language for new notes
language = "en"
# Default avatar, must be a valid URL or ""
avatar = ""
# avatar = ""
# Default header, must be a valid URL or ""
header = ""
# header = ""
[activitypub]
# Use ActivityPub Tombstones instead of deleting objects
@ -241,9 +230,9 @@ authorized_fetch = false
name = "Lysand"
description = "A test instance of Lysand"
# 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)
banner = ""
# banner = ""
[filters]

View file

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

View file

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