refactor(config): ♻️ Redo config structure from scratch, simplify validation code, improve checks, add support for loading sensitive data from paths

This commit is contained in:
Jesse Wierzbinski 2025-02-15 02:47:29 +01:00
parent d4afd84019
commit 54fd81f076
No known key found for this signature in database
118 changed files with 3892 additions and 5291 deletions

View file

@ -5,7 +5,7 @@ import chalk from "chalk";
import { and, eq, isNull } from "drizzle-orm";
import ora from "ora";
import { BaseCommand } from "~/cli/base";
import { config } from "~/packages/config-manager";
import { config } from "~/config.ts";
export default class EmojiAdd extends BaseCommand<typeof EmojiAdd> {
public static override args = {
@ -62,7 +62,7 @@ export default class EmojiAdd extends BaseCommand<typeof EmojiAdd> {
"Accept-Encoding": "identity",
},
// @ts-expect-error Proxy is a Bun-specific feature
proxy: config.http.proxy.address,
proxy: config.http.proxy_address,
});
if (!response.ok) {

View file

@ -7,7 +7,7 @@ import { lookup } from "mime-types";
import ora from "ora";
import { unzip } from "unzipit";
import { BaseCommand } from "~/cli/base";
import { config } from "~/packages/config-manager";
import { config } from "~/config.ts";
type MetaType = {
emojis: {
@ -69,7 +69,7 @@ export default class EmojiImport extends BaseCommand<typeof EmojiImport> {
"Accept-Encoding": "identity",
},
// @ts-expect-error Proxy is a Bun-specific feature
proxy: config.http.proxy.address,
proxy: config.http.proxy_address,
});
if (!response.ok) {

View file

@ -2,7 +2,7 @@ import { Args, Flags } from "@oclif/core";
import ora from "ora";
import { SonicIndexType, searchManager } from "~/classes/search/search-manager";
import { BaseCommand } from "~/cli/base";
import { config } from "~/packages/config-manager";
import { config } from "~/config.ts";
export default class IndexRebuild extends BaseCommand<typeof IndexRebuild> {
public static override args = {
@ -28,8 +28,8 @@ export default class IndexRebuild extends BaseCommand<typeof IndexRebuild> {
public async run(): Promise<void> {
const { flags, args } = await this.parse(IndexRebuild);
if (!config.sonic.enabled) {
this.error("Sonic search is disabled");
if (!config.search.enabled) {
this.error("Search is disabled");
this.exit(1);
}

View file

@ -4,7 +4,7 @@ import chalk from "chalk";
import { renderUnicodeCompact } from "uqr";
import { UserFinderCommand } from "~/cli/classes";
import { formatArray } from "~/cli/utils/format";
import { config } from "~/packages/config-manager";
import { config } from "~/config.ts";
export default class UserReset extends UserFinderCommand<typeof UserReset> {
public static override description = "Resets users' passwords";