add config module

This commit is contained in:
liuyi 2025-06-09 14:59:22 +08:00
parent 2afa6bcb4c
commit 2e4997da9c
4 changed files with 5 additions and 5 deletions

View File

@ -3,6 +3,6 @@ import { toNumber } from 'lodash';
import { createAppConfig } from '@/modules/core/config'; import { createAppConfig } from '@/modules/core/config';
export const app = createAppConfig((configure) => ({ export const app = createAppConfig((configure) => ({
port: configure.env.get<number>('APP_PORT', (v) => toNumber(v), 3099), port: configure.env.get<number>('APP_PORT', (v) => toNumber(v), 3000),
prefix: 'api', prefix: 'api',
})); }));

View File

@ -7,9 +7,9 @@ export const database = createDBConfig((configure) => ({
connections: [ connections: [
{ {
type: 'mysql', type: 'mysql',
host: configure.env.get('DB_HOST', '127.0.0.1'), host: configure.env.get('DB_HOST', '192.168.50.26'),
port: configure.env.get<number>('DB_PORT', (v) => toNumber(v), 3306), port: configure.env.get<number>('DB_PORT', (v) => toNumber(v), 3306),
username: configure.env.get('DB_USERNAME', 'root'), username: configure.env.get('DB_USERNAME', '3r'),
password: configure.env.get('DB_PASSWORD', '12345678'), password: configure.env.get('DB_PASSWORD', '12345678'),
database: configure.env.get('DB_NAME', '3r'), database: configure.env.get('DB_NAME', '3r'),
}, },

View File

@ -1,6 +1,6 @@
import { createMeiliConfig } from '../modules/meilisearch/config'; import { createMeiliConfig } from '../modules/meilisearch/config';
export const MEILI_CONFIG = createMeiliConfig((configure) => [ export const meili = createMeiliConfig((configure) => [
{ {
name: 'default', name: 'default',
host: 'http://192.168.50.26:7700', host: 'http://192.168.50.26:7700',

2
typings/global.d.ts vendored
View File

@ -12,7 +12,7 @@ declare type ClassToPlain<T> = { [key in keyof T]: T[key] };
declare type ClassType<T> = { new (...args: any[]): T }; declare type ClassType<T> = { new (...args: any[]): T };
declare type RePartial<T> = { declare type RePartial<T> = {
[P in keyof T]: T[P] extends (infer U)[] | undefined [P in keyof T]?: T[P] extends (infer U)[] | undefined
? RePartial<U>[] ? RePartial<U>[]
: T[P] extends object | undefined : T[P] extends object | undefined
? T[P] extends ((...args: any[]) => any) | ClassType<T[P]> | undefined ? T[P] extends ((...args: any[]) => any) | ClassType<T[P]> | undefined